赞
踩
控制台报错如下:
[Vue warn]: Error in event handler for "el.form.change": "TypeError: dateObject.getTime is not a function"
elementUI的日期选择器【el-date-picker】加上了格式 value-format=“yyyy-MM-dd” format=“yyyy-MM-dd”,而校验规则使用了type: ‘date’
<el-form-item prop="join_data">
<el-date-picker
v-model="ruleForm.applyDate"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
rules: {
applyDate: [{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }]
}
修改验证规则中的type或者直接去掉
rules: {
applyDate: [{ required: true, message: '请选择日期', trigger: 'change' }]
// applyDate: [{ type: 'string', required: true, message: '请选择日期', trigger: 'change' }]
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。