mirror of https://github.com/ElemeFE/element
Merge pull request #1140 from QingWei-Li/fix/loading-export
Loading: fix export modulepull/1193/head
commit
91c2940878
|
@ -39,8 +39,7 @@ module.exports = {
|
||||||
version: '{{version}}',
|
version: '{{version}}',
|
||||||
locale: locale.use,
|
locale: locale.use,
|
||||||
install,
|
install,
|
||||||
Loading: Loading.directive,
|
Loading,
|
||||||
LoadingService: Loading.service,
|
|
||||||
{{list}}
|
{{list}}
|
||||||
};
|
};
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -189,15 +189,15 @@ Show a full screen animation while loading data.
|
||||||
### Service
|
### Service
|
||||||
You can also invoke Loading with a service. Import Loading service:
|
You can also invoke Loading with a service. Import Loading service:
|
||||||
```javascript
|
```javascript
|
||||||
import { LoadingService } from 'element-ui';
|
import { Loading } from 'element-ui';
|
||||||
```
|
```
|
||||||
Invoke it:
|
Invoke it:
|
||||||
```javascript
|
```javascript
|
||||||
LoadingService(options);
|
Loading.service(options);
|
||||||
```
|
```
|
||||||
The parameter `options` is the configuration of Loading, and its details can be found in the following table. `LoadingService` returns a Loading instance, and you can close it by invoking its `close` method:
|
The parameter `options` is the configuration of Loading, and its details can be found in the following table. `LoadingService` returns a Loading instance, and you can close it by invoking its `close` method:
|
||||||
```javascript
|
```javascript
|
||||||
let loadingInstance = LoadingService(options);
|
let loadingInstance = Loading.service(options);
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
```
|
```
|
||||||
If Element is imported entirely, a globally method `$loading` will be registered to Vue.prototype. You can invoke it like this: `this.$loading(options)`, and it also returns a Loading instance.
|
If Element is imported entirely, a globally method `$loading` will be registered to Vue.prototype. You can invoke it like this: `this.$loading(options)`, and it also returns a Loading instance.
|
||||||
|
|
|
@ -193,15 +193,15 @@
|
||||||
### 服务
|
### 服务
|
||||||
Loading 还可以以服务的方式调用。引入 Loading 服务:
|
Loading 还可以以服务的方式调用。引入 Loading 服务:
|
||||||
```javascript
|
```javascript
|
||||||
import { LoadingService } from 'element-ui';
|
import { Loading } from 'element-ui';
|
||||||
```
|
```
|
||||||
在需要调用时:
|
在需要调用时:
|
||||||
```javascript
|
```javascript
|
||||||
LoadingService(options);
|
Loading.service(options);
|
||||||
```
|
```
|
||||||
其中 `options` 参数为 Loading 的配置项,具体见下表。`LoadingService` 会返回一个 Loading 实例,可通过调用该实例的 `close` 方法来关闭它:
|
其中 `options` 参数为 Loading 的配置项,具体见下表。`LoadingService` 会返回一个 Loading 实例,可通过调用该实例的 `close` 方法来关闭它:
|
||||||
```javascript
|
```javascript
|
||||||
let loadingInstance = LoadingService(options);
|
let loadingInstance = Loading.service(options);
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
```
|
```
|
||||||
如果完整引入了 Element,那么 Vue.prototype 上会有一个全局方法 `$loading`,它的调用方式为:`this.$loading(options)`,同样会返回一个 Loading 实例。
|
如果完整引入了 Element,那么 Vue.prototype 上会有一个全局方法 `$loading`,它的调用方式为:`this.$loading(options)`,同样会返回一个 Loading 实例。
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import directive from './src/directive';
|
import directive from './src/directive';
|
||||||
import service from './src/index';
|
import service from './src/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
install(Vue) {
|
||||||
|
Vue.use(directive);
|
||||||
|
Vue.prototype.$loading = service;
|
||||||
|
},
|
||||||
directive,
|
directive,
|
||||||
service
|
service
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,8 +134,7 @@ module.exports = {
|
||||||
version: '1.0.1',
|
version: '1.0.1',
|
||||||
locale: locale.use,
|
locale: locale.use,
|
||||||
install,
|
install,
|
||||||
Loading: Loading.directive,
|
Loading,
|
||||||
LoadingService: Loading.service,
|
|
||||||
Pagination,
|
Pagination,
|
||||||
Dialog,
|
Dialog,
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
|
|
Loading…
Reference in New Issue