Iview select remote search "apply when setting default" label setting initial value and setQuery are invalid

is when you click button and display the form remote search echo in the modal box, the value you want to echo is not the value bound in v-model, but it will automatically search for the bound value, that is, it will search for id instead of label.
invalid setQuery and invalid label set after clicking the button

<Select ref="agency" v-model="storeInfo.agencyId" :label="storeInfo.agencyName" 
filterable remote clearable placeholder="" :remote-method="searchAgency" :loading="searchLoading">
      <Option v-for="(item, index) in agencyList" :value="item.id" :key="item.id">{{item.agencyName}}</Option>
</Select>

//js:
getAgencyList(query = null) {
    return this.$post("/bbtAgency/list", {
        name: query.trim()
    }).then(res => {
        if (res.success) {
            this.agencyList = res.data.page.list;
        } else {
            this.$Message.error(res.message);
        }
    });
},
 searchAgency(query) {
    if (query != "") {
        this.searchLoading = true;

        this.getAgencyList(query).then(() => {
            this.searchLoading = false;
        });
    } else {
        this.agencyList = [];
    }
},
   

Apr.01,2022

replace the value in v-model with another value after getting this value asynchronously
use the setQuery in the document to pop up directly
remove the ref to set query this.$refs ["agency"]. Query = this.storeInfo.agencyName;


is like this, so if you want to echo the value of label, you can only bind the label value in the value property of the option option. To put it bluntly: both the label and value attributes are bound to the real label, which is only for the echo when the value is assigned manually, and then replace the selection of the control with a custom click option event, passing the parameter to the object (which contains the real label and vlaue values). You need to manually set the selected value and label

.

demo.png

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-1b33bbd-2beac.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-1b33bbd-2beac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?