You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
890 B
34 lines
890 B
import { VueConstructor } from 'vue'
|
|
import { VxeUI } from '@vxe-ui/core'
|
|
import VxeLoadingComponent from './src/loading'
|
|
import { dynamicApp, dynamicStore, checkDynamic } from '../dynamics'
|
|
|
|
import type { VxeLoadingProps } from '../../types'
|
|
|
|
export const VxeLoading = Object.assign({}, VxeLoadingComponent, {
|
|
install (app: VueConstructor) {
|
|
app.component(VxeLoadingComponent.name as string, VxeLoadingComponent)
|
|
}
|
|
})
|
|
|
|
export const LoadingController = {
|
|
open (options?: VxeLoadingProps) {
|
|
const opts = Object.assign({}, options)
|
|
dynamicStore.globalLoading = {
|
|
value: true,
|
|
text: opts.text,
|
|
icon: opts.icon
|
|
}
|
|
checkDynamic()
|
|
},
|
|
close () {
|
|
dynamicStore.globalLoading = null
|
|
}
|
|
}
|
|
|
|
dynamicApp.use(VxeLoading)
|
|
VxeUI.component(VxeLoadingComponent)
|
|
VxeUI.loading = LoadingController
|
|
|
|
export const Loading = VxeLoading
|
|
export default VxeLoading
|
|
|