handeltest(value){
console.log(this.role) //
须要哪一个值就取哪一个值,而后在data里面从新定义一个,赋值上去便可
},
打印如图:
方法2: option里面绑定的时候直接取值 eg: value="item.id" , 而后经过获得的值去和数组作对比(循环数组) 以下:
handeltest(val){
this.role = val
var obj = '';
obj = this.roleList.find(function(item) { //循环数组
if(item.id == val){ //若是里面的id 和咱们取的id 相等 那么就返回这一个对象
return item.crmcustomercode;
}
});
this.crmCustomerCode = obj.crmcustomercode //在对象里面须要哪一个取哪一个
},
方法3: 为 select 添加 value-key 属性,elment 文档里面也有提到,可是我这不生效,暂时还不知道什么缘由,后续补上