123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import Vue from 'vue'
- import UILoading from './Loading.vue'
- import UIBroadcast from './Broadcast.vue'
- import UIMap from './Map.vue'
- import UIAlert from './Alert.vue'
- const Loading = Vue.extend(UILoading)
- const Broadcast = Vue.extend(UIBroadcast)
- const Map = Vue.extend(UIMap)
- const Alert = Vue.extend(UIAlert)
- let alertInstance = ''
- export function $showAlert(data={}) {
- if (alertInstance) {
- return
- }
- alertInstance = new Alert({
- data
- }).$mount()
- document.body.appendChild(alertInstance.$el)
- Vue.nextTick(() => {
- alertInstance.show = true
- })
- }
- export function $hideAlert() {
- if (alertInstance) {
- document.body.removeChild(alertInstance.$el)
- alertInstance = ''
- }
- }
- let loadingInstance = ''
- export function $showLoading(data={}) {
- if (loadingInstance) {
- return
- }
- loadingInstance = new Loading({
- data
- }).$mount()
- document.body.appendChild(loadingInstance.$el)
- Vue.nextTick(() => {
- loadingInstance.show = true
- })
- }
- export function $hideLoading() {
- if (loadingInstance) {
- document.body.removeChild(loadingInstance.$el)
- loadingInstance = ''
- }
- }
- let broadcastInstance = ''
- export function $showBroadcast(data={}) {
- if (broadcastInstance) {
- return
- }
- broadcastInstance = new Broadcast({
- data
- }).$mount()
- document.body.appendChild(broadcastInstance.$el)
- Vue.nextTick(() => {
- broadcastInstance.show = true
- })
- }
- export function $hideBroadcast() {
- if (broadcastInstance) {
- document.body.removeChild(broadcastInstance.$el)
- broadcastInstance = ''
- }
- }
- let mapInstance = ''
- export function $showMap(data={}) {
- if (mapInstance) {
- return
- }
- mapInstance = new Map({
- data
- }).$mount()
- document.body.appendChild(mapInstance.$el)
- Vue.nextTick(() => {
- mapInstance.show = true
- })
- }
- export function $hideMap() {
- if (mapInstance) {
- document.body.removeChild(mapInstance.$el)
- mapInstance = ''
- }
- }
|