el-select的change
时间: 2023-10-13 07:02:04 浏览: 82
Select的OnChange()事件
el-select的change事件可以通过两种方式来使用。第一种方式是在select标签上添加@change="change",并在methods中定义change方法来处理事件。例如:
```
<el-select @change="change" v-model="value1" placeholder="请选择">
<el-option @focus="get1()" v-for="item in list2" :key="item.code + item.name" :label="item.code + item.name" :value="item.code + item.name"></el-option>
</el-select>
```
其中,change方法可以通过传入的事件对象e来获取对应的值。
第二种方式是在select标签上添加@change="change($event)",并在methods中定义change方法来处理事件。例如:
```
<el-select @change="change($event)" v-model="value1" placeholder="请选择">
<el-option @focus="get1()" v-for="item in list2" :key="item.code + item.name" :label="item.code + item.name" :value="item.code + item.name"></el-option>
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [el-select实现change](https://blog.csdn.net/weixin_45336090/article/details/128223034)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [elementUI中下拉选择器el-select中Select Events事件 change 方法参数两种使用 和option的focus触发焦点](https://blog.csdn.net/m0_49714202/article/details/122826148)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文