在用element-ui 时,报value.getTime is not a function错误:
错误分析:
date-picker 的时间是格林威时间,若是Thu Jun 22 2017 19:07:30 GMT+0800,而后咱们存入的数据库的时间为:2017-06-22 19:07:30的格式,因此在用2017-06-22 19:07:30去V-model date-picker就会报以上错误。
解决方案:
将2017-06-22 19:07:30 转换成Thu Jun 22 2017 19:07:30 GMT+0800便可!
附带格林威时间转换:vue中的转换
methods :{vue
GMTToStr : function(time){ let date = new Date(time) let Str=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() return Str }, StrToGMT(time){ let GMT = new Date(time) return GMT }
}数据库