加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

微信小程序JS导出和导入

发布时间:2020-12-14 19:35:51 所属栏目:资源 来源:网络整理
导读:1. 导出 1.1 方法和变量导出(写在被导出方法和变量的js文件) module . exports = { variable : value , method methodName } 1.2 class 导出( es6 语法) class HomeModule { constructor ( url ) { this url url ; } } export { } 2. 导入 2.1 方法和变量

1. 导出

1.1 方法和变量导出(写在被导出方法和变量的js文件)

  1. module.exports = {
  2. variable: value,
  3. }
  4. 1.2 class导出(es6语法)
  5. constructor(url){
  6. }
  7. export{}

2. 导入

2.1 方法和变量的引入(写在需要引入其他js的方法或变量的JS文件中)


  • http "../../../utils/http.js");
  • 2.2 class的引入