Acessar instância / dados vue dentro do método de filtro
Estou tentando acessar dados da instância vue dentro da função de filtro como esta. JS: -
new Vue({
data:{
amount: 10,
exchangeRate:50
},
el:"#app",
filters:{
currency: function(amount){
console.log(this);
//return amount * this.exchangeRate;
return amount *50;
}
}
})
HTML:
<div id="app">
{{ amount | currency}}
</div>
Meu objetivo é usarreturn amount * this.exchangeRate;
masthis
é igual awindow
aqui. Como posso fazer isso ? Obrigado.jsfiddle