1.2.8
window10
2.2.6
传入2015-05-02 这样的日期
在表单中能够验证成功,并正确提交
warn]: Error in callback for watcher "displayValue":
(found in <ElDatePicker>)
vue.esm.js?d2fe:1447 TypeError: value.getTime is not a function
at Object.date [as validator] (eval at <anonymous> (http://localhost:8080/app.js:2638:1), <anonymous>:28:45)
at eval (eval at <anonymous> (http://localhost:8080/app.js:2575:1), <anonymous>:232:12)
at next (eval at <anonymous> (http://localhost:8080/app.js:840:1), <anonymous>:133:7)
at asyncSerialArray (eval at <anonymous> (http://localhost:8080/app.js:840:1), <anonymous>:139:3)
at eval (eval at <anonymous> (http://localhost:8080/app.js:840:1), <anonymous>:173:7)
at Array.forEach (native)
at asyncMap (eval at <anonymous> (http://localhost:8080/app.js:840:1), <anonymous>:170:14)
at Schema.validate (eval at <anonymous> (http://localhost:8080/app.js:2575:1), <anonymous>:159:24)
at VueComponent.validate (eval at <anonymous> (http://localhost:8080/app.js:2477:1), <anonymous>:15691:18)
at VueComponent.boundFn [as validate] (eval at <anonymous> (http://localhost:8080/app.js:872:1), <anonymous>:125:14)
向表单中从数据库传入2017-05-02这样的日期,提交表单会报这样的错 , 验证类型是type:date , 从数据库拿到的是string类型 , 是这样的原因导致的吗 , 怎么解决呢
日期应该给 Date 类型的
请参照楼上的回复。
html是给的date类型
<el-date-picker type="date" placeholder="选择日期" v-model="sendArgs.InviteBeginTime" style="width: 100%;"></el-date-picker>
@CaraDelevingne 赋值的时候需要 new Date() 一下
Most helpful comment
@CaraDelevingne 赋值的时候需要 new Date() 一下