| 12345678910111213141516171819202122232425262728 |
- 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;
- }
- }
- };
|