diff --git a/docs/en-US/component/loading.md b/docs/en-US/component/loading.md index 6ba6b1fff6..a8359d632a 100644 --- a/docs/en-US/component/loading.md +++ b/docs/en-US/component/loading.md @@ -79,25 +79,27 @@ Calling the `close` method on any one of them can close this full screen Loading If Element Plus is imported entirely, a globally method `$loading` will be registered to `app.config.globalProperties`. You can invoke it like this: `this.$loading(options)`, and it also returns a Loading instance. -## Options +## API -| Attribute | Description | Type | Accepted Values | Default | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | --------------- | ------------- | -| target | the DOM node Loading needs to cover. Accepts a DOM object or a string. If it's a string, it will be passed to `document.querySelector` to get the corresponding DOM node | object/string | — | document.body | -| body | same as the `body` modifier of `v-loading` | boolean | — | false | -| fullscreen | same as the `fullscreen` modifier of `v-loading` | boolean | — | true | -| lock | same as the `lock` modifier of `v-loading` | boolean | — | false | -| text | loading text that displays under the spinner | string | — | — | -| spinner | class name of the custom spinner | string | — | — | -| background | background color of the mask | string | — | — | -| custom-class | custom class name for Loading | string | — | — | +### Options -## Directives +| Name | Description | Type | Default | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- | ------------- | +| target | the DOM node Loading needs to cover. Accepts a DOM object or a string. If it's a string, it will be passed to `document.querySelector` to get the corresponding DOM node | ^[string] / ^[HTMLElement] | document.body | +| body | same as the `body` modifier of `v-loading` | ^[boolean] | false | +| fullscreen | same as the `fullscreen` modifier of `v-loading` | ^[boolean] | true | +| lock | same as the `lock` modifier of `v-loading` | ^[boolean] | false | +| text | loading text that displays under the spinner | ^[string] | — | +| spinner | class name of the custom spinner | ^[string] | — | +| background | background color of the mask | ^[string] | — | +| customClass | custom class name for Loading | ^[string] | — | -| Name | Description | Type | -| -------------------------- | ------------------------------------------------------------ | ------- | -| v-loading | show animation while loading data | boolean | -| element-loading-text | loading text that displays under the spinner | string | -| element-loading-spinner | icon of the custom spinner | string | -| element-loading-svg | icon of the custom spinner (same as element-loading-spinner) | string | -| element-loading-background | background color of the mask | string | +### Directives + +| Name | Description | Type | +| -------------------------- | ------------------------------------------------------------ | ----------------------- | +| v-loading | show animation while loading data | ^[boolean] / ^[Options] | +| element-loading-text | loading text that displays under the spinner | ^[string] | +| element-loading-spinner | icon of the custom spinner | ^[string] | +| element-loading-svg | icon of the custom spinner (same as element-loading-spinner) | ^[string] | +| element-loading-background | background color of the mask | ^[string] | diff --git a/packages/components/loading/src/types.ts b/packages/components/loading/src/types.ts index 7636490dbd..c04f1a4d24 100644 --- a/packages/components/loading/src/types.ts +++ b/packages/components/loading/src/types.ts @@ -2,13 +2,31 @@ import type { MaybeRef } from '@vueuse/core' export type LoadingOptionsResolved = { parent: LoadingParentElement + /** + * @description background color of the mask + */ background: MaybeRef svg: MaybeRef svgViewBox: MaybeRef + /** + * @description class name of the custom spinner + */ spinner: MaybeRef + /** + * @description loading text that displays under the spinner + */ text: MaybeRef + /** + * @description same as the `fullscreen` modifier of `v-loading` + */ fullscreen: boolean + /** + * @description same as the `lock` modifier of `v-loading` + */ lock: boolean + /** + * @description custom class name for Loading + */ customClass: MaybeRef visible: boolean target: HTMLElement @@ -17,7 +35,13 @@ export type LoadingOptionsResolved = { } export type LoadingOptions = Partial< Omit & { + /** + * @description the DOM node Loading needs to cover. Accepts a DOM object or a string. If it's a string, it will be passed to `document.querySelector` to get the corresponding DOM node + */ target: HTMLElement | string + /** + * @description same as the `body` modifier of `v-loading` + */ body: boolean } >