简体   繁体   English

Vue.js中的组件未加载到Laravel刀片中

[英]Components from Vue.js are not loaded in Laravel blade

Installed vue js with node modules for laravel 5.4 project but the components are not displayed after I run npm run watch 为laravel 5.4项目安装了带有节点模块的vue js,但是在我运行npm run watch之后不显示组件

Installed npm, installed vue.js added vue.js file example in app.js, npm run watch - no result 已安装npm,已安装vue.js,在app.js中添加了vue.js文件示例,npm运行监视-无结果

blade template file 刀片模板文件

  <div id="app">
      <h1>Test</h1>
      <h2>asda</h2>
      <example-component></example-component>
  </div>

App.js App.js

 import Vue from 'vue';

 Vue.component('example-component', 
 require('./components/ExampleComponent.vue'));



    //Set toaster duration
    Vue.config.productionTip = false

    new Vue({
        el: '#app',
        components: {

        }
  })

The component should be loaded after page refresh but is not. 页面刷新后应加载该组件,但不加载。 No any error messages in console. 控制台中没有任何错误消息。

  1. If you are using Webpack, you should append the require(...) with .default so it becomes require(...).default . 如果您使用的是Webpack,则应在require(...)后面附加.default以使其成为require(...).default Example in Laravel Git Laravel Git中的示例
  2. Make sure that you export default in your components. 确保在组件中export default Example in Laravel Git Laravel Git中的示例

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

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