Laravel: vue components not rendering

前端 未结 3 1345
滥情空心
滥情空心 2021-01-19 07:18

My vue components are not rendering on the page, despite following tutorials. I have the following layout (master.blade.php):



    &         


        
相关标签:
3条回答
  • 2021-01-19 07:39

    // UPDATE

    require('./bootstrap');
    
    window.Vue = require('vue');
    
    Vue.component('example-component', require('./components/ExampleComponent.vue').default);
    
    const app = new Vue({
        el: '#app'
    });
    

    add .default in component in your app.js. Change your link and script uri

    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
    <script src="{{ asset('js/app.js') }}"> </script>
    
    0 讨论(0)
  • 2021-01-19 07:41

    Maybe your component is not rendering due to wrong path issue for app.css and app.js.

    Try to render by using asset like :

    <link href="{{asset('css/app.css')}}" rel="stylesheet" type="text/css">

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

    0 讨论(0)
  • 2021-01-19 07:58

    try to add div element below of template and inside of the div enter your code and then in your terminal enter npm run watch or npm run dev wait until the compiled message comes up in your terminal if their is error it will prompt you

    0 讨论(0)
提交回复
热议问题