其他分享
首页 > 其他分享> > elementui中el-input联想搜索框

elementui中el-input联想搜索框

作者:互联网

1,html代码 <el-autocomplete             v-model="query.providername"             :fetch-suggestions="providernameSearch"             placeholder="请输入内容"             @select="handleProvidername"             :trigger-on-focus="false"           ></el-autocomplete>   2,js providernameSearch(queryString,callback){       var list = [{}]       if(queryString && queryString.length>0){         let parms = {           name:queryString         }         providerformFindProvider(parms).then(res=>{           if(res.status == "ok"){    //处理成自己想要的格式             list = res.data.map(item=>{               return {                 id:`${item.id}`,                 value:`${item.name}`               }             })             callback(list);           }         })       }     },     handleProvidername(item){       this.query.providername = item.value;       this.providername = item.value;     },

标签:el,elementui,res,queryString,value,item,list,input,parms
来源: https://www.cnblogs.com/wswm/p/13723893.html