Vue component not showing in laravel

后端 未结 4 1127
梦毁少年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: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) }}"
    

提交回复
热议问题