element select change事件获取项
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/c71eecd6ff975f5ff0df5eb456085b07.png)
<template>
<div>
<!--obj此时是对象-->
<el-select v-model="obj" value-key="value" @change="change" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="`${item.label}`"
:value="item"><!--绑定整个对象item-->
{{item.label}}
</el-option>
</el-select>
</div>
</template>
<script>
export default {
name: '',
data (){
return {
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
obj: {}
}
},
created() {
},
methods: {
// chnage触发
change(e) {
console.log(e);// 打印整个对象
}
}
}
</script>
<style scoped>
</style>