@@ -102,16 +113,18 @@ Displays animation in a container (such as a table) while loading data.
...
@@ -102,16 +113,18 @@ Displays animation in a container (such as a table) while loading data.
```
```
:::
:::
### Loading text
### Customization
You can customize a text message.
You can customize loading text, loading spinner and background color.
:::demo Add attribute `element-loading-text` to the element on which `v-loading` is bound, and its value will be displayed under the spinner.
:::demo Add attribute `element-loading-text` to the element on which `v-loading` is bound, and its value will be displayed under the spinner. Similarly, `element-loading-spinner` and `element-loading-background` are for customizing loading spinner class name and background color.
```html
```html
<template>
<template>
<el-table
<el-table
v-loading="loading2"
v-loading="loading2"
element-loading-text="Loading..."
element-loading-text="Loading..."
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
:data="tableData"
:data="tableData"
style="width: 100%">
style="width: 100%">
<el-table-column
<el-table-column
...
@@ -160,7 +173,7 @@ You can customize a text message.
...
@@ -160,7 +173,7 @@ You can customize a text message.
Show a full screen animation while loading data.
Show a full screen animation while loading data.
:::demo Add the `fullscreen` modifier to create a full screen mask, and it will append to body. In this case, if you disable scrolling on body, you add another modifier `lock`.
:::demo When used as a directive, a full screen Loading requires the `fullscreen` modifier, and it will be appended to body. In this case, if you wish to disable scrolling on body, you can add another modifier `lock`. When used as a service, Loading will be full screen by default.
```html
```html
<template>
<template>
...
@@ -168,7 +181,12 @@ Show a full screen animation while loading data.
...
@@ -168,7 +181,12 @@ Show a full screen animation while loading data.
type="primary"
type="primary"
@click="openFullScreen"
@click="openFullScreen"
v-loading.fullscreen.lock="fullscreenLoading">
v-loading.fullscreen.lock="fullscreenLoading">
Full screen loading for 3 seconds
As a directive
</el-button>
<el-button
type="primary"
@click="openFullScreen2">
As a service
</el-button>
</el-button>
</template>
</template>
...
@@ -184,7 +202,18 @@ Show a full screen animation while loading data.
...
@@ -184,7 +202,18 @@ Show a full screen animation while loading data.
this.fullscreenLoading=true;
this.fullscreenLoading=true;
setTimeout(()=>{
setTimeout(()=>{
this.fullscreenLoading=false;
this.fullscreenLoading=false;
},3000);
},2000);
},
openFullScreen2(){
constloading=this.$loading({
lock:true,
text:'Loading',
spinner:'el-icon-loading',
background:'rgba(0, 0, 0, 0.7)'
});
setTimeout(()=>{
loading.close();
},2000);
}
}
}
}
}
}
...
@@ -224,4 +253,6 @@ If Element is imported entirely, a globally method `$loading` will be registered
...
@@ -224,4 +253,6 @@ If Element is imported entirely, a globally method `$loading` will be registered
| fullscreen | same as the `fullscreen` modifier of `v-loading` | boolean | — | true |
| fullscreen | same as the `fullscreen` modifier of `v-loading` | boolean | — | true |
| lock | same as the `lock` modifier of `v-loading` | boolean | — | false |
| lock | same as the `lock` modifier of `v-loading` | boolean | — | false |
| text | loading text that displays under the spinner | string | — | — |
| 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 | — | — |
| customClass | custom class name for Loading | string | — | — |