最近在用iview,遇到这个问题,也是差了好多地方再次记录一下,希望对小伙伴有帮助,有帮助记得点赞哟!
<Form ref="formValidate" :model="entity" :rules="ruleValidate" :label-width="100">
<Row>
<Col span="24">
<!-- -->
<FormItem label="工时" prop="taskTime">
<DatePicker
v-model="entity.taskTime"
type="datetimerange"
placement="bottom-start"
format="yyyy-MM-dd HH:mm"
:options="dateRange"
@on-change="handleChange"
placeholder="请选择时间段"
style="width: 330px"
></DatePicker>
</FormItem>
</Col>
</Row>
</Form>
taskTime: [{
required: true,
type: 'array',
message: "请选择工时时间段",
trigger: 'blur',
fields: {
0: {type: "date", required: true, message: "请选择工时时间段"},
1: {type: "date", required: true, message: "请选择工时时间段"}
}
}]
尤其注意“[]”里面的{}
感谢:
原文链接:https://www.cnblogs.com/phpli/p/10732092.html