// 缓存 wx 接口方法名
          this.instanceSource = {
               method: Object.keys(wx)
          }__initMethods() {
         
          for (let key in this.instanceSource) {
               this.instanceSource[key].forEach((method, index) => {
                  
                    this[method] = (...args) => {
                        
                         // 判断是否为非异步方法或以 wx.on 开头,或以 Sync 结尾的方法
                         if (this.noPromiseMethods.indexOf(method) !== -1 || method.substr(0, 2) === 'on' || /\w+Sync$/.test(method)) {
                             console.log('88888888888888888888')
                             console.log(wx[method](...args))
                              return wx[method](...args)
                              
                         }
                         return this.__defaultRequest(method, ...args)
                    }
                    
               })
          }
.....
}----------------------------------
this[method] = (...args)  这句没看懂,请明白的给指导一下呢,谢谢了
两个,1是this[method] 2j  ...args

解决方案 »

  1.   

       this[method] = (...args) => { 代码 }
    this是当前对象、method是个字符串变量,如method的值是"abc",就是设置this.abc
    (...args) => { 代码 } 是个箭头函数,详细的看: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions
    ...args 是剩余参数的语法,详细的看: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Rest_parameters