国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

vue select 獲取value和lable操作

瀏覽:178日期:2022-12-03 11:07:40

vue select控件在選擇時需要把id和name兩個值都獲取到,實現(xiàn)方案如下:

select控件代碼

<FormItem label='物資類型:' prop='supplyType'> <Select v-model='detailData.supplyType' :label-in-value='true' placeholder='請選擇物資類型' @on-change='getVendorId'> <Option v-for='item in supplyTypeList' :value='item.id' :key='item.id' :lable='item.dictionaryName'>{{ item.dictionaryName }} </Option> </Select> </FormItem>

change事件

getVendorId: function (val) { let that = this; that.detailData.supplyType=val.value;//獲取label that.detailData.supplyTypeName=val.label;//獲取value},

下拉組件綁定數(shù)據(jù)源

supplyTypeList[ { 'id': 45, 'dictionaryName': '辦公用品', 'dictionaryCode': 'nofficeSupplies' } ]

補充知識:vue選擇器select獲取選中項的value和id

今天在nuxt項目中使用element-ui的選擇器時,有個需求要獲取options的id和label。

做法如下:

html代碼

vue select 獲取value和lable操作

在methods中:

vue select 獲取value和lable操作

這樣就可以精準的獲取到啦,希望可以幫到你呀!

以上這篇vue select 獲取value和lable操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。

標簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 荣成市| 乐安县| 临邑县| 合水县| 九龙县| 陆丰市| 清流县| 龙泉市| 精河县| 咸宁市| 礼泉县| 塔城市| 十堰市| 高淳县| 吉安县| 万全县| 察隅县| 财经| 新密市| 公主岭市| 景德镇市| 乌鲁木齐县| 满洲里市| 靖宇县| 河西区| 泌阳县| 扎赉特旗| 鄱阳县| 无为县| 昭平县| 梨树县| 大新县| 饶河县| 弋阳县| 舒城县| 那坡县| 都江堰市| 河西区| 彰化县| 贵州省| 桑日县|