Skip to content

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

Merged
merged 1 commit into from
Nov 13, 2014

Conversation

BigBlueHat
Copy link
Contributor

Example's pretty much how I use it. 😸

Let me know if you'd prefer something else!

JSON.stringify() incoming value rather than outputting the string representation (i.e. `[object Object]`).

``` html
<textarea v-model="$data | json"></textarea>
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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.

@BigBlueHat
Copy link
Contributor Author

@yyx990803 fixed.

yyx990803 added a commit that referenced this pull request Nov 13, 2014
Add `json` filter information and example
@yyx990803 yyx990803 merged commit 8274f07 into vuejs:master Nov 13, 2014
@yyx990803
Copy link
Member

Thanks!

dingyiming added a commit that referenced this pull request Dec 21, 2016
lex111 pushed a commit to lex111/vuejs.org that referenced this pull request Feb 3, 2018
isatrio pushed a commit to isatrio/vuejs.org that referenced this pull request Mar 6, 2019
isatrio pushed a commit to isatrio/vuejs.org that referenced this pull request Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants