A problem of ivew passing value?! O_0?!

<Select @on-change="setOption" 
:label-in-value="true" 
style="width: 150px" 
placeholder="" 
v-model="model12" 
filterable>

    <Option v-for="item in cityList" :value="item.value">{{ item.label }}</Option>

</Select>
cityList: [
        {
            id:"11",
            value: "beijing",
            label: ""
        },
        {
            id:"31",
            value: "shanghai",
            label: ""
        },
        {
            id:"13",
            value: "hebei",
            label: ""
        },
    ],
setOption(v){
    console.log(v);
},

is such a simple code, why only console.log label and value.

how can I get ID?

Apr.25,2022

clipboard.png

isn't it written that only value and lable (open label-in-value ) will be returned.

do you want to send id back directly? those two methods:

    In the case of
  1. manually submitting the form, join id and value together with a separator, and manually disassemble it in on-change to get id
  2. .
  3. write a tool method based on lable or value to find the corresponding id

    const id = this.cityList.filter(c => c.label === label && c.value === value)[0]
    if (!id) {
       console.error(`label: ${label}, value: ${value}  id!`) // 
    }
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-1beb660-31a6d.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-1beb660-31a6d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?