-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add json
filter information and example
#43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
JSON.stringify() incoming value rather than outputting the string representation (i.e. `[object Object]`). | ||
|
||
``` html | ||
<textarea v-model="$data | json"></textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use <textarea>
and v-model
here? The json
filter is a read only filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Good point. I was using it for some quick debugging (not bi-directionally). <textarea>{{$data | json}}</textarea>
works just as well. Shall I change it to that?
FWIW, I do have a project that uses bi-directional JSON, but I've not yet tested it with 0.11.0 and this json
filter (though I'm hoping it'll serve for part of that need):
https://github.com/BigBlueHat/vue-schema/blob/master/app.js#L1-L13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably better to use <pre>
instead, just to avoid possible confusions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Fix en route.
@yyx990803 fixed. |
Add `json` filter information and example
Thanks! |
Airyboy fixes 2
Fixes vuejs#43 Meet the team
Example's pretty much how I use it. 😸
Let me know if you'd prefer something else!