Laravel Vue组件未显示

时间:2017-02-23 07:44:35

标签: laravel components show vuejs2

我对这段代码很感兴趣。我无法使其发挥作用,我也没有任何错误。这可能意味着我需要一个附加的依赖?它根本就没有显示出来。请帮我。感谢。

app.js - file

Vue.component('message', require('./components/Message.vue'));

const app = new Vue({
    el: '#app'
});

Message.vue - file

<template>
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Message</div>
                    <div class="panel-body">
                        I'm the component!
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        ready () {
            console.log('Component ready')
        }
    }
</script>

home.blade.php - file

@extends('templates.default')

@section('content')
    <h3>Welcome to Site</h3>
    <div class="container">
        <div id="app">
            <message></message>
        </div>
    </div>
@stop

1 个答案:

答案 0 :(得分:0)

我认为您在行中缺少.default

Vue.component('message', require('./components/Message.vue').default);