<template>
<el-select v-model="value" placeholder="请选择" @change="changeValue">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
data:function(){
return {
options: [{
value: '选项1',
label: '黄金糕',
id:'1',
}, {
value: '选项2',
label: '双皮奶',
id:'2',
}, {
value: '选项3',
label: '蚵仔煎',
id:'3',
}, {
value: '选项4',
label: '龙须面',
id:'4',
}, {
value: '选项5',
label: '北京烤鸭',
id:'5',
}],
value: ''
}
}
},
methods:{
changeValue(val) {
console.log(val);
let obj = {};
obj = this.options.find((item)=>{
return item.value === val;
});
console.log(obj.label);
console.log(obj.id);
}
}