UNPKG

c-mobile

Version:

Vue 手机端组件,支持 megalo

32 lines (29 loc) 730 B
import Vue from 'vue' import Loading from './loading.vue' let component export default { show (text) { component = new Vue({ render (h) { return h(Loading, { props: { text } }) } }).$mount() document.body.classList.add('c-mobile__is-loading') const nodeList = document.querySelectorAll('.c-loading') for (var i = 0; i < nodeList.length; ++i) { nodeList[i].remove() } document.body.appendChild(component.$el) }, hide () { document.body.classList.remove('c-mobile__is-loading') const nodeList = document.querySelectorAll('.c-loading') for (var i = 0; i < nodeList.length; ++i) { nodeList[i].remove() } } }