vue antd a-select 获取元素自定义属性值

<a-select show-search
          allowClear
          placeholder=""
          option-filter-prop="children"
          :filter-option="filterOption"
          v-model="model.xiangmudm"
          @change="getxm">
  <a-select-option :value="data.xiangmudm+'-'+data.pinpaidm"
                   v-for="data in xmdaimaList"
                   :data-val="data.id"
                   :key="data.id">{{data.xiangmudm+'-'+data.pinpaidm}}</a-select-option>
</a-select>

a-select-option 元素中自定义属性:data-val

getxm (value, e) {
  let id = e.data.attrs["data-val"];//获取属性值
  console.log(id); 
},

平时点点滴滴技术分享~
大家一起进步~

Logo

前往低代码交流专区

更多推荐