Using filters inside attributes with Vue 2.0
See original GitHub issueBoth of the following work in Vue 1:
<a href="{{ 'something' | linkHandler }}">link</a>
<a :href="'something' | linkHandler">link</a>
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?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Filters - Vue.js
Filters. Vue.js allows you to define filters that can be used to apply common text formatting. Filters are usable in two places: mustache...
Read more >Using Filters in Vue.js - CSS-Tricks
Filters are an interesting way to deal with data rendering in Vue but are only useful in a small amount of cases.
Read more >Everything You Should Know About Filters in Vue - Telerik
Learn everything you need to know about Vue.js filters, from how to use them in your Vue.js application to how to create your...
Read more >Using multiple filters in v-for directive in Vue 2.0 - Stack Overflow
Found the answer from here. Basically, we only need one computed function to return the filtered data for v-for directive, e.g..
Read more >How to Use VueJS Filters to Write Better Code - LearnVue
Coding a Vue filter should feel extremely familiar. Like defining computed properties or component methods in the Options API, just put them in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It work with
<a :href="$options.filters.linkHandler('somthings')">link</a>
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.