文档写的太简单了
发布于 6 年前 作者 uchang 7185 次浏览 来自 官方Issues

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的文档,没有说明上述用法。上述用法和文档描述的不同,我不知道什么区别

2 回复

http://es6.ruanyifeng.com/#docs/module

要弄懂,不是光看小程序的文档。也需要参考其他资料。

回到顶部