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; }, } }