Xiaobai’s way to the front end

Time:2021-6-14
1. HTML code
            v-model=”query.providername”
            :fetch-suggestions=”providernameSearch”
Placeholder = “please input content
            @select=”handleProvidername”
            :trigger-on-focus=”false”
          >
 
2,js
providernameSearch(queryString,callback){
      var list = [{}]
      if(queryString && queryString.length>0){
        let parms = {
          name:queryString
        }
        providerformFindProvider(parms).then(res=>{
          if(res.status == “ok”){
//Process it to the format you want
            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;
    },