filterOption (inputValue, option) { // 在option的componentOptions.propsData中只有value和label,也就是说其他自定义属性没有接收,所以只能自己去查找 let currentOption for (let index = 0, len = this.depOptions.length; index < len; index++) { const element = this.depOptions[index] if (element.id === option.componentOptions.propsData.value) { currentOption = element break } } return currentOption.departName.includes(inputValue) },
depOptions是下拉数组
主要是 filterOption 和 showSearch 来实现搜索