Vue component not showing in laravel

后端 未结 4 1124
梦毁少年i
梦毁少年i 2021-01-19 22:24

So I\'m trying to migrate my jquery to vue framework instead, I\'m using laravel 5.6 with webpack to build my project but my vue components are not showing up.

when

相关标签:
4条回答
  • 2021-01-19 22:33

    Some time you have re install npm

    npm install
    npm run dev
    

    Thats solved my problem.

    0 讨论(0)
  • 2021-01-19 22:47

    I think you need to load app.js before </body> as below.

    <body id="app" class="">
      //sidebar
      <script src=" {{ mix('js/app.js') }} "></script>
    </body>
    
    0 讨论(0)
  • 2021-01-19 22:50

    :post="@json($classPost)" is your issue. @json doesn't escape the output for use in a HTML attribute, which is why your screenshot of the source in the browser has that line in bright red - it's invalid (because of the " characters in the resulting JSON, which end the attribute prematurely).

    This'll do the trick:

    :post="{{ json_encode($classPost) }}"
    
    0 讨论(0)
  • 2021-01-19 22:54

    you have to load your /resources/js/app.js file. put this inside your <head></head> tag

    <script src="{{ asset('js/app.js') }}" defer></script>
    
    0 讨论(0)
提交回复
热议问题