方法一
main.js引入moment
獲取當前時間
this.time = this.$moment()._d; // 當前時間
this.time0 =this.$moment().subtract(1, 'hours')._d //當前時間的前一小時
打印this.$moment
方法二
當前頁面引入Moment
this.time = Moment().toDate(); // 當前時間
this.time0 = Moment().subtract(1, 'hours').toDate() //當前時間的前一小時
顯示時,用iview中datepicker 的format
<DatePicker :value="time" format="yyyy-MM-dd HH:mm:ss " type="daterange" placement="bottom-end" placeholder="Select date" style="width: 200px"></DatePicker>