diff --git a/src/views/modules/common/print-list.vue b/src/views/modules/common/print-list.vue index 361f0df..ab1e7be 100644 --- a/src/views/modules/common/print-list.vue +++ b/src/views/modules/common/print-list.vue @@ -16,13 +16,24 @@ - - - + + + + + + + + + + @@ -72,6 +83,17 @@ export default { }) }, methods: { + querySearch(queryString, cb) { + var restaurants = this.printList; + var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; + // 调用 callback 返回建议列表的数据 + cb(results); + }, + createFilter(queryString) { + return (restaurant) => { + return (restaurant.label.indexOf(queryString) === 0); + }; + }, selectBlur(e){ this.userPrint.printername = e.target.value }, @@ -93,7 +115,7 @@ export default { let list = [] for (let child of children) { let option = { - value: child.index, + value: child.innerText, label: child.innerText } list.push(option)