mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-16 12:04:12 +08:00

* fix(components): [loading] inherit app context in ssr mode * chore: get appContext inherit in childApp * docs: add loading inheritance * Update docs/en-US/component/loading.md Co-authored-by: qiang <qw13131wang@gmail.com> --------- Co-authored-by: qiang <qw13131wang@gmail.com>
27 lines
742 B
TypeScript
27 lines
742 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'
|