-
-
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
Using filters inside attributes with Vue 2.0 #4080
Comments
You could use a computed property |
Kinda defeats the point in using a filter, though. I don't want to declare 30 computed properties, and I don't want to declare duplicate methods across multiple components. |
@callumacrae declare method in mixin (and use it) or in Vue.prototype like Vue.prototype.$linkHandler = function (value) {....} and use |
@iagafonov: How is that not a workaround? What are filters for? I'd suggest that you should either be able to be able to use filters everywhere—which would mean allowing interpolations as attributes when there is a filter—or filters should be removed. The current behaviour is confusing. |
This has been discussed extensively during the 2.0 API design thread - please read that thread, most of the arguments have been raised already. Filters were originally to be removed but added back for the most common use case due to community request. It's not going to change in the foreseeable future. |
It work with |
Thank you for changing your mind on this 🙌 🙌 🙌 |
Its not working for me. <p v-html="getHtml('status')"></p> I want to apply i have columns like i tried this : <p v-html="$options.filters.caps(getHtml('status'))"></p> any idea ? |
If the |
Also I see a lot of use for filters in attributes ... certain words going to lowercase as css class for example |
This is quite old but filters can be used in v-bind directives as well as text interpolation: https://vuejs.org/v2/guide/filters.html |
Both of the following work in Vue 1:
Neither of them work in Vue 2.0, because you can only use filters inside interpolations, and you can't use interpolations as attributes anymore.
Any way around this?
The text was updated successfully, but these errors were encountered: