<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>vue自定义过滤器</title> <script src="https://unpkg.com/vue/dist/vue.js"></script></head><body> <div id="app"> <input v-model='search'/> <ul v-for="item in products "> <li>{{item.name}},价格:¥{{item.price}}</li> </ul> </div> <script> Vue.filter('searchFilter', function(value) { ... })var vm = new Vue({ el:'#app', data: { products: [ {name: '苹果',price: 25,category: "水果"}, {name: '香蕉',price: 15,category: "水果"}, {name: '雪梨',price: 65,category: "水果"}, {name: '宝马',price: 2500,category: "汽车"}, {name: '奔驰',price: 10025,category: "汽车"}, {name: '柑橘',price: 15,category: "水果"}, {name: '奥迪',price: 25,category: "汽车"} ] }})</script></body></html>
添加回答
举报
0/150
提交
取消