tnblog
首页
视频
资源
登录

vue-elementui table loading效果,加载效果

9371人阅读 2021/11/24 16:59 总访问:744952 评论:0 收藏:0 手机
分类: 前端


官方文档:
https://element.eleme.cn/#/zh-CN/component/loading


Element 提供了两种调用 Loading 的方法:指令和服务。对于自定义指令v-loading,只需要绑定Boolean即可。默认状况下,Loading 遮罩会插入到绑定元素的子节点,通过添加body修饰符,可以使遮罩插入至 DOM 中的 body 上。

  1. <template>
  2.   <el-table
  3.     v-loading="loading"
  4.     :data="tableData"
  5.     style="width: 100%">
  6.     <el-table-column
  7.       prop="date"
  8.       label="日期"
  9.       width="180">
  10.     </el-table-column>
  11.     <el-table-column
  12.       prop="name"
  13.       label="姓名"
  14.       width="180">
  15.     </el-table-column>
  16.     <el-table-column
  17.       prop="address"
  18.       label="地址">
  19.     </el-table-column>
  20.   </el-table>
  21. </template>
  22. <style>
  23.   body {
  24.     margin0;
  25.   }
  26. </style>
  27. <script>
  28.   export default {
  29.     data() {
  30.       return {
  31.         tableData: [{
  32.           date'2016-05-03',
  33.           name'王小虎',
  34.           address'上海市普陀区金沙江路 1518 弄'
  35.         }, {
  36.           date'2016-05-02',
  37.           name'王小虎',
  38.           address'上海市普陀区金沙江路 1518 弄'
  39.         }, {
  40.           date'2016-05-04',
  41.           name'王小虎',
  42.           address'上海市普陀区金沙江路 1518 弄'
  43.         }],
  44.         loadingtrue
  45.       };
  46.     }
  47.   };
  48. </script>

整页加载:

  1. <template>
  2.   <el-button
  3.     type="primary"
  4.     @click="openFullScreen1"
  5.     v-loading.fullscreen.lock="fullscreenLoading">
  6.     指令方式
  7.   </el-button>
  8.   <el-button
  9.     type="primary"
  10.     @click="openFullScreen2">
  11.     服务方式
  12.   </el-button>
  13. </template>
  14. <script>
  15.   export default {
  16.     data() {
  17.       return {
  18.         fullscreenLoadingfalse
  19.       }
  20.     },
  21.     methods: {
  22.       openFullScreen1() {
  23.         this.fullscreenLoading = true;
  24.         setTimeout(() => {
  25.           this.fullscreenLoading = false;
  26.         }, 2000);
  27.       },
  28.       openFullScreen2() {
  29.         const loading = this.$loading({
  30.           locktrue,
  31.           text'Loading',
  32.           spinner'el-icon-loading',
  33.           background'rgba(0, 0, 0, 0.7)'
  34.         });
  35.         setTimeout(() => {
  36.           loading.close();
  37.         }, 2000);
  38.       }
  39.     }
  40.   }
  41. </script>


欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)

评价
真诚,善良,美好,温柔,皆是你
排名
137
文章
1
粉丝
1
评论
0
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术