var Chinese = new RegExp('[\u4E00-\u9FA5]+') //中文 var Letter = new RegExp('[A-Za-z]+') //字母 if (Chinese.test(this.systemInput)) { //中文搜索 this.showOpList = this.List.filter(array => { if (array.title != undefined) { return array.title.indexOf(this.systemInput) >= 0 } return false }) } if (Letter.test(this.systemInput)) { //字母搜索 this.showOpList = this.List.filter(array => { let flag = false if (array.letter != undefined) { flag = array.letter.indexOf(this.systemInput) >= 0 } if (array.spelling != undefined && !flag) { flag = array.spelling.indexOf(this.systemInput) >= 0 } return flag }) }