https://developers.weixin.qq.com/miniprogram/dev/reference/api/require.html
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() +
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join(’-’) + ’ ’ + [hour, minute, second].map(formatNumber).join(’:’
const formatNumber = n => {
n = n.toString()
return n[] ? n : ‘0’ + n
module.exports = {
formatTime: formatTime
}
关于module的文档,没有说明上述用法。上述用法和文档描述的不同,我不知道什么区别