You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
985 B
34 lines
985 B
10 months ago
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
list_filtered:[]
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
matchPinyinSearch(searchContent) {
|
||
|
console.log('searchContent',searchContent);
|
||
|
if (searchContent) {
|
||
|
let result = [];
|
||
|
this.userList.forEach((item) => {
|
||
|
// matchResult 的值为 true/false
|
||
|
let matchResult = this.$pinYinMatch.match(item.realName, searchContent);
|
||
|
// console.log('matchResult',matchResult);
|
||
|
if (matchResult) {
|
||
|
result.push(item);
|
||
|
console.log('result',result);
|
||
|
}
|
||
|
});
|
||
|
this.list_filtered = result;
|
||
|
} else {
|
||
|
this.list_filtered = this.userList;
|
||
|
}
|
||
|
},
|
||
|
clearPinyinSearch() {
|
||
|
this.list_filtered = this.userList;
|
||
|
},
|
||
|
}
|
||
|
}
|