UNPKG

sk-smart-ui

Version:

简洁快速的vue ui框架

27 lines (24 loc) 624 B
import Vue from 'vue'; let Loading = Vue.extend(require('./Loading.vue')); let instance; export default { show(text) { if(!instance) { instance = new Loading({ el: document.createElement('div') }); } if(instance.show) return; instance.text = text ? text : '加载中'; instance.show = true; document.body.appendChild(instance.$el); Vue.nextTick(() => { instance.show = true; }); }, close() { if(instance) { instance.show = false; } } }