1、过滤器的基本概念
{{ message | filterFunction ‘arg1‘ arg2}}//过滤器函数中传入的参数以后面开始的参数来统计和赋值
2、过滤器种类
import Vue from ‘vue‘
Vue.filter(‘uppercase‘,function(value){
if(value){
return value.toUpperCase()
}
})
使用:{{ data | uppercase}} data : ‘wxh‘
结果:WXH
实例写法:
<template> <div id="example">{{ data | uppercase}}</div> </template> <script> export default { name: "example", data() { return { data: "wxh", }; }, filters: { uppercase: function(value) { return value.toUpperCase() } }, methods: {} }; </script>
使用与结果跟上边一样
3、遇到的问题
原文:https://www.cnblogs.com/wxh0929/p/11188044.html