简体   繁体   English

来自 app.js 的 Vue 数据未显示在 Laravel Blade 中

[英]Vue data from app.js is not showing in laravel blade

My console is我的控制台是

and my app.js is like this我的app.js是这样的

const app = new Vue({
  el: '#app',
  data: {
    msg: 'my new msg'
  }
});

and my blade template is like this我的刀片模板是这样的

<div id="app">
  @{{ msg }}
</div>

You are probably not having the component placed inside the blade file.您可能没有将组件放置在刀片文件中。

Add the <example-component></example-component> tag into your home.blade.php or whichever .blade.php file that you are using.<example-component></example-component>标记添加到您的home.blade.php或您正在使用的任何.blade.php文件中。

The code to put in your home.blade.php放在home.blade.php 中的代码

  <script src="{{ mix('js/app.js') }}"></script>

  </body>

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

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