下拉列表el-select獲取選中的value和label(值和id)
阿新 • • 發佈:2022-06-06
姓名:<el-select v-model="ruleForm.userName" placeholder="請選擇" style="width: 100px" @change="towerChange" > <el-option v-for="item in Users" :key="item.userId" :label="item.userName" :value="item" //注意這裡對應change能獲取的值 > </el-option> </el-select>
------------------------------------------------------------------------------------------------------------------------------------------
towerChange(e) { //獲取的值和id this.ruleForm.userId = e.userId;TRANSLATE with x English TRANSLATE with EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Backthis.ruleForm.userName = e.userName; },