Laravel undefined variable exception with vue.js

前端 未结 2 391
醉话见心
醉话见心 2021-01-13 09:04

I want to test a simple vue.js in laravel blade system, Here is my code in test.blade.php view file:

{{message}}

2条回答
  •  情话喂你
    2021-01-13 09:18

    It's not a good approach to combine the same notation for front-end and back-end. Of course, with the @, Blade can ignore.

    A much cleaner idea is to extract the front-end from back-end, because Blade and Vue.js use the same notation:

    • Front-end with html, css en javascript (in your case Vue.js)
    • Back-end (in php, Laravel in your case) as REST-api with php that returns json

    The big advantages:

    • It's more secure
    • It's more maintainable
    • It's cleaner

提交回复
热议问题