// 搜索mixin export const searchUserMixin = { data () { return { isSearch: false, // 搜索展示 searchList: null // 搜索结果 } }, methods: { searchUser (e, originList) { let val = e.target.value if (!val) { this.isSearch = false return } this.searchList = originList.filter(item => { let name = item.name || item.nick_name return name.indexOf(val) > -1 }) this.isSearch = true } } } // @人 export const chatAtMixin = { data () { return { atInd: 0 // @人索引 } }, methods: { atPerson (name) { let el = this.$refs.chatInput this.inputMsg += `${name} ` this.atInd = 0 el.focus() }, handleUp () { if (this.atInd > 0) { this.atInd-- } }, handleDown () { let membersLen = this.group.userCounts this.atInd < membersLen - 1 ? this.atInd++ : this.atInd = 0 } } }