保存进度!
This commit is contained in:
parent
225189854c
commit
9397c45b87
|
@ -2,8 +2,8 @@
|
||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-05-24 21:47:36
|
* @Date: 2022-05-24 21:47:36
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-05-24 22:12:10
|
* @LastEditTime: 2022-05-25 11:01:43
|
||||||
* @FilePath: \vue学习\列表过滤\列表过滤.html
|
* @FilePath: \vue.js学习\列表过滤\列表过滤.html
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<fieldset title="过滤">
|
<fieldset title="过滤">
|
||||||
<legend> 过滤 </legend>
|
<legend> 过滤 </legend>
|
||||||
<label for=""
|
<label for=""
|
||||||
>姓名:<input type="text" v-on:keydown.enter="filteName();"
|
>姓名:<input type="text" v-model:value="nameFilter"
|
||||||
/></label>
|
/></label>
|
||||||
<label
|
<label
|
||||||
>性别:
|
>性别:
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="person in personsList" v-bind:key="person.id">
|
<li v-for="person in filteredPersonList" v-bind:key="person.id">
|
||||||
姓名:{{person.name}} - 性别:{{person.sex}} -
|
姓名:{{person.name}} - 性别:{{person.sex}} -
|
||||||
年龄:{{person.age}}
|
年龄:{{person.age}}
|
||||||
</li>
|
</li>
|
||||||
|
@ -58,12 +58,20 @@
|
||||||
{ id: "003", name: "周杰伦", sex: "男", age: 33 },
|
{ id: "003", name: "周杰伦", sex: "男", age: 33 },
|
||||||
{ id: "004", name: "温兆伦", sex: "男", age: 52 },
|
{ id: "004", name: "温兆伦", sex: "男", age: 52 },
|
||||||
],
|
],
|
||||||
|
nameFilter: "",
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
filteName: function () {
|
filteName: function () {
|
||||||
console.log("过滤名字");
|
console.log("过滤名字");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
filteredPersonList() {
|
||||||
|
return this.personsList.filter((p) => {
|
||||||
|
return p.name.indexOf(this.nameFilter) != -1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue