监听事件(选择器组件重置)
<a-select
style="width: 250px"
@change="get_department_id"
placeholder="请选择部门"
:value="select_option"
>
<a-select-option value="0">所有部门</a-select-option>
<a-select-option
:value="item.value"
v-for="item in All_Department"
:key="item.value"
>{{ item.label }}</a-select-option
>
</a-select>
export default {
data() {
return {
env: "test",
};
watch: {
env: function (newVal, oldVal) {
this.select_option = "0";
},
}
上面意思是 如果 env 发生变化,那么就会执行this.select_option = "0"; 从而实现下拉组件重置
不重置的 看下这个 https://www.cnblogs.com/kaibindirver/p/15774573.html