ElementUI使用autocomplete组件输入搜索

2020-09-03 11:26:47 浏览数 (1)

代码语言:javascript复制
 <el-autocomplete v-model="clientName" :trigger-on-focus="false" highlight-first-item 
 :fetch-suggestions="queryName" @select="getSelect"  placeholder="请输入查询姓名">
</el-autocomplete>
代码语言:javascript复制
queryName(queryString, callback) {
	var queryList = []
	//假定list为后台传输的数据
		for (let item of list) {
				queryList.push({
					value: item.name,
					id: item.id,
				})
			}
			callback(queryList);
		}
	})
},

0 人点赞