Element UI 实现页面加载loading

1 引包,声明全局变量

import { Loading } from 'element-ui';
let loading;

2 加载函数

const startLoading = () => {  // 使用Element loading-start 方法
  loading = Loading.service({
    lock: true,
    text: '加载中……',
    background: 'rgba(0, 0, 0, 0.7)'
  });
};

3 调用

 loading.close(); // 关闭加载
 startLoading();  // 开启加载

猜你喜欢

转载自blog.csdn.net/qq_37896578/article/details/90229470