module.exports用法
时间:2019-01-01 23:36:17
收藏:0
阅读:151
module.exports 对象是由模块系统创建的。在我们自己写模块的时候,需要在模块最后写好模块接口,声明这个模块对外暴露什么内容,module.exports 提供了暴露接口的方法。
1、返回一个JSON Object
这种方法可以返回全局共享的变量或者方法。
调用方法:
或者这样用:
原文:https://www.cnblogs.com/zhq--blog/p/10206444.html
评论(0)