繁体   English   中英

在Laravel 5.4中Vue2不变

[英]Vue2 not change in Laravel 5.4

我正在尝试在Laravel中使用Vue。 当我修改example.vue并将其添加到视图中时,视图没有变化。 这是Laravel拥有的.vue示例。

 <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">Example Component</div>

                    <div class="panel-body">
                        I'm an example component!
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

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

我试图修改此文件并运行npm run dev ,但没有任何变化。 任何想法?

您可能需要在app.js中取消注释require行。 在Laravel 5.4上,它位于/resources/assets/js/app.js文件中。

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

// Vue.component('example', require('./components/Example.vue'));
// ^^^^^^^^^^^^^^^^^^^^^^ Uncomment this line ^^^^^^^^^^^^^^^^^^^^^^

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM