Files
element-plus/packages/components/loading/index.ts
Jevin 12ffd3cfd8 feat(components): [loading] export LoadingInstance (#22027)
* feat: add export LoadingInstance

* chore: update
2025-09-04 15:28:44 +08:00

28 lines
795 B
TypeScript

import Loading from './src/service'
import vLoading from './src/directive'
import type { App, AppContext, Directive } from 'vue'
import type { ElementLoading, LoadingBinding } from './src/directive'
// installer and everything in all
export const ElLoading = {
install(app: App) {
Loading._context = app._context
;(
vLoading as Directive<ElementLoading, LoadingBinding> & {
_context: AppContext | null
}
)._context = app._context
app.directive('loading', vLoading)
app.config.globalProperties.$loading = Loading
},
directive: vLoading,
service: Loading,
}
export default ElLoading
export { vLoading, vLoading as ElLoadingDirective, Loading as ElLoadingService }
export * from './src/types'
export type { LoadingInstance } from './src/loading'