如有不明白請加羣號:複製 695182980 ,也可掃碼,但願能幫助到你們。this
案例演示:獲取select當前選中的全部內容post
1 <el-select v-model="value8" filterable placeholder="請選擇" value-key="id" @change="currentSel"> 2 <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item"></el-option> 3 </el-select>
1 options: [ 2 { 3 value: "選項1", 4 id: 1, 5 code: "xuanxiang1", 6 label: "黃金糕" 7 }, 8 { 9 code: "xuanxiang2", 10 id: 2, 11 value: "選項2", 12 label: "雙皮奶" 13 }, 14 { 15 id: 3, 16 value: "選項3", 17 code: "xuanxiang3", 18 label: "蚵仔煎" 19 }, 20 { 21 value: "選項4", 22 id: 4, 23 code: "xuanxiang4", 24 label: "龍鬚麪" 25 }, 26 { 27 value: "選項5", 28 label: "北京烤鴨", 29 id: 5, 30 code: "xuanxiang5" 31 } 32 ],
1 currentSel(selVal) { 2 this.code = selVal.code; 3 this.name = selVal.label; 4 console.log("選擇的name爲:" + this.name, "選擇的code爲:" + this.code); 5 console.log(selVal); 6 },
如有不明白請加羣號:複製 695182980 ,也可掃碼,但願能幫助到你們。this