el-select获取选中的label值
看了网上很多方法,都是循环选项去获取,我觉得应该没必要。给el-select加上ref = ‘myselect’
,然后写个方法debugger一下看看,在 this.$refs.myselect
里面有一个selected属性,就是选中项,这个里面有value和label两个属性,就是我们需要的。
所以最终写法就是 this.$refs.myselect.selected.label
,选中值就是 this.$refs.myselect.selected.value
如果你在这个el-select的 @change内去获取label的话,那只能去循环了。
let thisLabel = this.options.find( item => item.id == param).fullName