When using the select component of iview for remote search, there was a problem with the editing function and the default value could not be selected.

< FormItem label= "responsible person:" prop= "chargeUserId" >

        <Select v-model="cubForm.chargeUserId" 
                filterable clearable remote :remote-method="remoteMethod2"
                :loading="loading2">
          <Option v-for="item in userList" :key="item.id" :value="item.id" :label="item.name"
                  style="width: 250px">
          </Option>
        </Select>

< / FormItem >

      
      
    remoteMethod2(query) { 
    let self = this;
      if (query) {
        self.loading2 = true;
        let params = {
          name: query
        }
        this.$api.get("/user/search", {params: params}).then(function (res) {
          if (res.data.code === 200) {
            self.userList = res.data.data.list;
          } else {
            self.$Message.error("" + res.data.code);
          }
        })
        this.loading2 = false;
      }
  },
  
   userListpush

clipboard.png
select select"nishuo"
clipboard.png

clipboard.png

Mar.06,2021

set the ref property of the select control in template

<Select v-model="cubForm.chargeUserId" 
                filterable clearable remote :remote-method="remoteMethod2"
                :loading="loading2" ref="setQuery">
          <Option v-for="item in userList" :key="item.id" :value="item.id" :label="item.name"
                  style="width: 250px">
          </Option>
        </Select>

call

in script
this.$refs.setQuery.setQuery(value) //value

this color font will flash blind


I also encountered the same problem. Do you still remember how to solve it? thank you!


how did you solve this problem

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b7e7-40ade.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b7e7-40ade.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?