<div class="demo-input-suffix">
<el-autocomplete
v-model="searchcurriculum"
class="inline-input"
:fetch-suggestions="querySearch"
placeholder="请输入名称后匹配建议"
:trigger-on-focus="false"
@select="handleSelectcurriculum"
/>
</div>
export default {
data() {
return {
restaurants: [],
searchcuslist: [],
searchcurriculum: '',
}
},
created() {
this.getAllcurriculum()
},
mounted() {
},
methods: {
getAllcurriculum() {
this.request.getMan(this.api.shopseselect).then(res => {
if (res.code == 1) {
const that = this
this.curricululists = res.data
res.data.forEach((v, index) => {
that.searchcuslist.push({ 'value': v.name, 'id': v.id })
})
this.restaurants = this.loadAll()
}
})
},
querySearch(queryString, cb) {
var restaurants = this.restaurants
var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
cb(results)
},
createFilter(queryString) {
return (restaurant) => {
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
}
},
loadAll() {
var that = this
return that.searchcuslist
},
handleSelectcurriculum(item) {
console.log(item)
}
}
}