将vue中需要拆分的代码copy到你创建的JS页面(假设为SevenRoomMethodSprit.js)中,

class SevenRoomMethodSprit {
  // eslint-disable-next-line no-useless-constructor
  constructor () {
  }
  static getInstance () {
    if (!this.instance) {
      this.instance = new SevenRoomMethodSprit()
    }
    return this.instance
  }
  // 封装之后的方法
  getEpool (equipmentConfig, that) {
  // 需要封装的代码
}

export default SevenRoomMethodSprit

调用:
1.创建对象
let sevenRoomMethodSprit = new SevenRoomMethodSprit();
2.调用方法
SevenRoomMethodSprit.getEpool(that.equipmentConfig,that);

Logo

前往低代码交流专区

更多推荐