index.js 569 Bytes
Newer Older
Nature's avatar
Nature committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import Vue from 'vue'
import ActionSheet from './actionsheet'

import elementUtil from '../../common/scripts/elementUtil'

class VueActionSheet {
  constructor () {
    this._vm = undefined
  }
  show (option) {
    elementUtil.createElement('vum-action-sheet')

    this._vm = new Vue(ActionSheet)
    this._vm.$mount('[vum-action-sheet]')

    setTimeout(() => {
      this._vm.show(option)
    })
  }

  hide (buttonIndex) {
    this._vm.hide(buttonIndex)
  }

  getState () {
    return this._vm ? this._vm.getState() : 0
  }
}

export default new VueActionSheet()