项目用的vue+elementUI, elementUI时间组件的获取是标准时间,
我用js来格式化
比如简单的:
var time = new Date('Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)');
newDate=time .getFullYear() + '-' + (time .getMonth() + 1) + '-' + time .getDate() + ' ' + time .getHours() + ':' + time .getMinutes() + ':' + time .getSeconds();
这样运行之后就会报错
这是什么原因呢
代码直接运行没问题
你是不是把这些代码直接写到了html模版里?应该写个计算属性