一重Prototype写法

// 录音管理
let record = function (recorderManager) {
  this.recorderManager = recorderManager
  this.recordStart()
}
record.prototype = {
  // 开始录音
  start: function (startObj) {
    this.recorderManager.start(startObj)
  },
  //录音开始事件
  recordStart: function () {
    this.recorderManager.onStart(() => {
      console.log(this.recorderManager, 'this.recorderManager')
    })
  }
}
        that.newRecord.start(startObj)
//录音管理,new 出 第二阶段的实例
    recorderManager = wx.getRecorderManager()
    that.newRecord = new record(recorderManager)
     that.newRecord.recorderManager.onStop((res) => {
         console.log(res, '获取录制完的链接')
    })

猜你喜欢

转载自blog.csdn.net/sd19871122/article/details/83146834