mint-ui
Version:
Mobile UI elements for vue.js
29 lines (24 loc) • 619 B
JavaScript
import Vue from 'vue';
const Indicator = Vue.extend(require('./src/indicator.vue'));
let instance;
export default {
open(options = {}) {
if (!instance) {
instance = new Indicator({
el: document.createElement('div')
});
}
if (instance.visible) return;
instance.text = typeof options === 'string' ? options : options.text || '';
instance.spinnerType = options.spinnerType || 'snake';
document.body.appendChild(instance.$el);
Vue.nextTick(() => {
instance.visible = true;
});
},
close() {
if (instance) {
instance.visible = false;
}
}
};