• 00
  • :
  • 00
  • :
  • 00

JS export

到处可实例化的类

export default class GuaDanBLL {
  // 属性
  db = null
  // 构造函数
  constructor() {
    debugger
   
  }
  // 方法
  add(item) {
    debugger
    var _request = this.db
      .transaction(['tb_guadan'], 'readwrite')
      .objectStore('tb_guadan')
      .add(item)
  }
}

使用:

import GuaDanBLL from '@/libs/guadanBLL.js'

var bll=new GuaDanBLL();

 到处已经实例化的类

export default {
  // 属性
  db = null,// 方法
  add(item) {
    debugger
    var _request = this.db
      .transaction(['tb_guadan'], 'readwrite')
      .objectStore('tb_guadan')
      .add(item)
  }
}

使用:

import GuaDanBLL from '@/libs/guadanBLL.js'

GuaDanBLL.add('');

导出可选择

export const M1 = {
  add(){
      
  }      
}

export const M2 = {
  add(){
      
  }      
}

export const M3 = {
  add(){
      
  }      
}

使用:

import {M1,M2,M3} from '@/libs/guadanBLL.js'

 

posted @ 2020-10-21 16:13  Garson_Zhang  阅读(504)  评论(0编辑  收藏  举报