-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
1.7.7
Environment
vuex 3.0
Reproduction link
Steps to reproduce
a-range-picker也接收不到v-modal的值,form表单校验类型type 根据官网提示写array最后还是string
提交
<script>
export default {
data() {
return {
form: {},
};
},
methods: {
handelSelDate(date) {
// if (date.length > 0) {
// this.$nextTick(() => {
// this.form.schedulingTime = [...date];
// this.$refs.ruleForm.clearValidate(["schedulingTime"]);
// });
// }
this.form.schedulingTime = [...date];
},
disabledDateHandler(current) {
//当前周开始时间 //当前周结束时间
return (
current && !(current.isoWeekday() === 1 || current.isoWeekday() === 7)
);
},
validateArray(rule, value, callback) {
value = this.form.schedulingTime;
if (
(value && !Array.isArray(value)) ||
(Array.isArray(value) && value.length == 0)
) {
callback(new Error("请选择排班时间"));
} else {
callback();
}
},
handelSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
console.log(this.form, "111111111111");
} else {
return false;
}
});
},
},
computed: {
rules() {
let rules = {
schedulingTime: [
{
required: true,
type: "array",
trigger: "change",
message: "请选择排班时间",
},
{ validator: this.validateArray, message: "请选择排班时间" },
],
};
if (this.modelType == "oneClick") {
rules["lastWeekRotation"] = [
{
required: true,
message: "请选择是否按照上周轮转",
trigger: "change",
},
];
}
return rules;
},
},
};
</script>
What is expected?
如何解决日期区间校验问题
What is actually happening?
a-range-picker也接收不到v-modal的值,form表单校验类型type 根据官网提示写array最后还是string