文档写的太简单了

发布于 8 年前作者 uchang7370 次浏览最后编辑 8 年前来自 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 回复
lei24
lei241 楼6 年前

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

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

yang67
yang672 楼6 年前

加油~