Can we see some screenshots of the Vue error
Jun 19, 2017
7
Level 5
Pass JSON to a Vue Component
In my blade file, I add something like this:
<tags tags="{{ $tags }}"></tags>
Because $tags is a Laravel collection, tags are automatically converted to JSON. However, when I access them from Vue, they're a string. I tried doing this:
created() { this.tags = JSON.parse(this.tags); }
But that triggered a Vue error about immutability.
So - how do I pass JSON data from Laravel to Vue without using AJAX or global variables?
Level 47
you should pass tags as object , then Vue can traversal it
<tags :tags="{{ $tags }}"></tags>
:is very important , without it ,you are passing a single string to vue.
8 likes
Please or to participate in this conversation.