-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
v-html does not work with filters #4352
Comments
2.0 filters only work in mustache tags and v-bind. |
How to implement a highlight that was simple in v.1:
with filter |
@SlyNet put your |
What if I have a filter that outputs HTML? Do I have to use a computed property or is there a better way? |
Computed properties are the best way. You get automatic caching. |
You can use
|
Fridus - works indeed! But looks like undocumented private API |
@Fridus this works fine ,thx |
@Fridus You can safely rely on that: |
@Fridus I really like this way to do it. No nasty mustache tags needed for this! Thanks! |
The solution |
Vue.js version
2.1.3
Reproduction Link
https://jsfiddle.net/peterkorgaard/t1Lxnwoq/16/
Steps to reproduce
In my fiddle I have added a filter and two uses of it. One with v-html and one with mustache interpolations. The first one (v-html) returns 0 and throws an error in the console. The latter prints the html code produced by the filter - but it is of course not rendered as html, because this is not supported with mustache interpolations. The example with v-html, on the other hand, should render as html.
What is Expected?
Rendered html
What is actually happening?
Vue does not recognize the filter when using v-html. For the record. The same thing happens when using v-text.
The text was updated successfully, but these errors were encountered: