给日期指定返回格式为yyyy-MM-dd时,报错 Error in event handler for “el.form.blur”: “TypeError: dateObject.getTime is not a function”
<el-date-picker
v-model="ruleForm.time"
type="date"
placeholder="选择日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
ref="selectdate"
:disabled="false">
</el-date-picker>
这时因为表单校验格式的问题导致
rules: {
time: [
{ type: 'date', required: true, message: '请选择日期', trigger: ['blur', 'change'] }
],
},
把type:‘date’ 改为 type: ‘string’