Basic usage
<div id="app">
{{x | tese}}
</div>
Copy the code
const app = new Vue({
el: '#app'.data: {
x:1
},
filters: {tese(value){
return value == 0?'male':'woman'}},conponents: {},
methods: {},
mounted(){}})Copy the code
The method of value
<div id="app">{{x | tese (' ')}}</div>
Copy the code
const app = new Vue({
el: '#app'.data: {
x:1
},
filters: {tese(value,params){
return (value == 0?'male':'woman') + params
}
},
conponents: {},
methods: {},
mounted(){}})Copy the code
It can also be filtered multiple times
<div id="app">{{x | tese (' ') | test2}}</div>
Copy the code