Fork me on GitHub

div中添加el-loading(局部loading的使用)

div 中添加 el-loading(局部 loading 的使用)

效果:在 div 中实现 el-loading

https://img-blog.csdnimg.cn/c2870e74bd344b06ad1ccb0844b8e8ce.png

 <div class="content-main">
          {{ hotList }}
 </div>

    getHotList(columnType) {
      this.$nextTick(() => {
        var loading = this.$loading({
          lock: true,
          text: "努力加载中...",
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.5)",
          target: document.querySelector(".content-main")  // 替换成你的类名
        });

        try {
            getPolicyList({columnType, pageNum: 1, pageSize: 10}).then(res15 => {
              this.hotList = res15.data.rows
            }).finally(() => {
              loading.close();
            })
        } catch (error) {
          console.error(error);
        }
      })
    },


posted @ 2024-08-05 10:34  毛三仙  阅读(183)  评论(0)    收藏  举报