In Laravel 5, how do you give variables in vue-enabled templates?

Before vue is part of Laravel I would often debug just using {{dump ($ var)}}

Now this makes an exception in javascript, as Vue doesn't like script> tags in the body of the content. It's not a game, but it's annoying. It still shows the entire array, only that the JavaScript around it no longer works.

Is there a Vue equivalent to dump laravel? Can I tell Vue to ignore script tags when doing debugging?

To be clear, I'm looking for a variable output from PHP where it shows properties, attributes, value type, etc. I don't want to render an object in JavaScript.

+3


source to share


2 answers


console.log () will work, but it will only work via javascript, but I personally suggest you use the vue.js plugin from the browser? its a way to better understand what is actually going on on your vue variables in the back.

heres a link for



vue dev tools chrome

then in your browser (F12) u will find it from Vue tab alongside console, web html.

0


source


You can try {{var_dump ($ variable)}}

If you just want to see the contents of the variables you are working with, you can use PHP's var_dump () functions instead of dump (). It is not as smooth as dump () and you cannot collapse or expand sections as you can with dump (). But it dumps the data you want without running into your Vue code.



{{dump ($ variable)}} without Vue: dump image

{{var_dump ($ variable)}} with or without Vue: var_dump image

0


source







All Articles