{"size": 736, "ext": "js", "max_stars_repo_path": "packages/indicator/src/indicator.js", "max_stars_repo_name": "JR93/mu-ui", "max_stars_repo_stars_event_min_datetime": "2019-04-04T02:28:06.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-22T13:31:48.000Z", "max_issues_repo_path": "packages/indicator/src/indicator.js", "max_issues_repo_name": "JR93/mu-ui", "max_issues_repo_issues_event_min_datetime": "2019-12-29T05:22:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T13:27:22.000Z", "max_forks_repo_path": "packages/indicator/src/indicator.js", "max_forks_repo_name": "JR93/mu-ui", "max_forks_repo_forks_event_min_datetime": "2019-04-04T02:28:07.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-04T02:28:07.000Z"}
{"max_stars_count": 2, "max_issues_count": 8, "max_forks_count": 1, "avg_line_length": 20.4444444444, "max_line_length": 44, "alphanum_fraction": 0.6059782609}
import Vue from 'vue'
import Loading from '@mu-ui/mu-loading'
import Indicator from './indicator.vue'

Vue.component('mu-loading', Loading)
const IndicatorClass = Vue.extend(Indicator)

let instance = null

export default {
  show(options = {}) {
    if (typeof options === 'string') {
      options = {
        tip: options
      }
    }
    if (!instance) {
      instance = new IndicatorClass({
        propsData: options
      }).$mount()
    } else if (instance.show) {
      return
    }
    document.body.appendChild(instance.$el)
  },
  hide() {
    instance.show = false
    instance.$destroy()
    const parent = instance.$el.parentNode
    if (parent) {
      parent.removeChild(instance.$el)
    }
    instance = null
  }
}
