Say I have a Vue instance like so:
new Vue({
el: '#app',
data: {
word: 'foo',
},
filters: {
capitalize: function(text) {
return text.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
}
},
methods: {
sendData: function() {
var payload = this.$filters.capitalize(this.word); // how?
}
}
}
I can easily use the filter in a template like so:
<span>The word is {{ word | capitalize }}</span>
But how can I use this filter from within an instance method or computed property? (Obviously this example is trivial and my actual filters are more complex).