1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| var app = new Vue({ el: '#app', data: { sousuo: '', list: [{ "id": 1, "name": "艾希", "jn": "射箭" }, { "id": 2, "name": "狐狸", "jn": "魅惑" }, { "id": 3, "name": "猴子", "jn": "棍子" }, { "id": 4, "name": "盖伦", "jn": "大宝剑" }, { "id": 5, "name": "德邦", "jn": "尖枪" }, { "id": 6, "name": "皇子", "jn": "旗子" },
] }, computed: { Search() { if (this.sousuo) { return this.list.filter((value) => { return value.name.includes(this.sousuo); }); } } }, methods: { sousuo1() { if (!this.sousuo) { return this.list; } return this.Search } }, })
|