html <td>{{serverInfo.serverTime| formatTime('YMDHMS')}}</td> js serverTime: new Date().getTime(), filters: { // 时间过滤器 formatTime: function(value, type) { let dataTime = ""; let data = new Date(); data.setTime(value); let year = data
vue实现的倒计时在苹果手机上无效,原因是因为后台返回的时间格式是'2019-1-29 17:13:04',而苹果手机只能解析这种时间格式'YYYY/MM/DD HH:mm:ss',修改后测试成功的代码如下: npm install moment -save; this.countdown(); countdown(){ var date = new Date(); var now = date.getTime(); //设置截止时间 let time = moment(this.activit