1π
From what I get here is that you are trying to use a filter as method. You can achieve this using this.$options.filters.filterName().
For the given case, you should try something like:
<a v-bind:href="'https://mysite.mydatabase?ID='+$options.filters.shorten(longid )">{{ longid }}</a>
.
Fiddle for reference: https://jsfiddle.net/sharitu/nbm2v1dx/3/
0π
- You can define method shorten and use like
<a v-bind:href="`https://mysite.mydatabase?ID=${shorten(longid)}`">{{ longid }}</a>
- Consider change your
shorten
function:
shorten: function(myString){
return myString.split('.').pop()
}
- [Vuejs]-How to display my search to my table in VueJs?
- [Vuejs]-Vue.JS Applications Throws Errors JS Expected
-1π
Try this:
<a v-bind:href="'https://mysite.mydatabase?ID='+longid | shorten(longid)">{{ longid }}</a>
Your filters function should change like this:
filters: {
shorten: function(myString,longid){
//return your code;
}
},
First argument is the url and second argument is longid parameter
- [Vuejs]-Vue.js adding dynamic input fields based on menu selection
- [Vuejs]-Problem with @import sass files in Vuej.s
Source:stackexchange.com