After transitioning to VueJS 2, I encountered a challenge.
While using a filter that calls a custom function, I received the error message:
TypeError: this.decodeHtml is not a function
Below is my code snippet:
new Vue({
el: '#modal',
data: {...}
computed: {...}
methods: {
decodeHtml: function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
},
... },
filters: {
html: function html(_html) {
return this.decodeHtml(_html);
}
}
In my HTML, it's called like this: @{{ categoryFullName | html }}
Any insight on why this issue occurred after migration? It was functioning properly before.
Check out the code on this fiddle link