Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Laravel 5, how do you dump variables on vue enabled templates?

Prior to vue being part of Laravel, I would often debug by simply using {{ dump($var) }}

Doing so now throws an exception within javascript as Vue doesn't like <script> tags within the body of the content. It's not game breaking, but it is annoying. It still shows the whole array, just that the JavaScript around it doesn't work anymore.

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

To be clear, I'm looking to output the variable from PHP where it shows the properties, attributes, the type of value etc. I'm not looking to output an object within JavaScript.

like image 349
Recognizer Avatar asked Nov 18 '22 19:11

Recognizer


1 Answers

console.log() will work but it will work only via javascript but i personally suggest that you will use vue.js plugin from browser? its way better to understand what is really happening on your vue variables in the back.

heres the link for

vue dev tools chrome

then on your browser(F12) u will find it from Vue tab together console,network html.

like image 58
Winston Fale Avatar answered Dec 25 '22 07:12

Winston Fale