mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-15 15:42:50 +00:00
添加 动态设置必填 的示例
This commit is contained in:
parent
7b0f4966a8
commit
334428e5cf
@ -63,6 +63,24 @@ function open() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '是否必填',
|
||||||
|
prop: 'required',
|
||||||
|
component: {
|
||||||
|
name: 'el-switch',
|
||||||
|
props: {
|
||||||
|
onChange(val) {
|
||||||
|
Form.value.setData('nickname', { required: val });
|
||||||
|
|
||||||
|
// 如果不必填,可以加一步骤清空校验
|
||||||
|
if (!val) {
|
||||||
|
Form.value.clearValidate('nickname');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
on: {
|
on: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user