// pages/m_service/c_schedule/c_schedule.js const moment = require('../../../utils/moment.min') Component({ options: { addGlobalClass: true }, /** * 组件的属性列表 */ properties: { title: { type: String, value: '营业执照续期' }, time: { type: String, value: '2022-9-10 星期六' }, leftDays: { type: Number, value: 2 }, }, /** * 组件的初始数据 */ data: { }, lifetimes: { attached: function () { this._init() } }, /** * 组件的方法列表 */ methods: { _init() { moment.updateLocale('en', { weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_') }); // console.log(moment.locales()); // moment.locale('ch') const now = moment().hour(0).minute(0).second(0).millisecond(0) const s = moment(now).add(3, 'days') let leftDays = now.diff(s, 'days') const time = s.format('YYYY-MM-DD dddd') this.setData({ time, leftDays }) }, goto() { wx.navigateTo({ url: '/pages/m_service/p_scheduledetail/p_scheduledetail', success: (result) => {}, }) } } })