1. 程式人生 > 其它 >Loading 遮罩

Loading 遮罩

        batchDelete(){
            if (this.dataList.length == 0) {
              this.$message.warning('無可操作資料,請勾選後在執行!')
              return;
            }
            this.$confirm('是否確認刪除?', '提示', {
              confirmButtonText: '確定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(async () => {
              const loading = this.$loading({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
              });

              for (let a in this.dataList) {
                loading.setText((a * 1 + 1) + "/" + this.dataList.length)
                await delObj(this.dataList[a].id).then(res => {
                })
              }

              loading.close();
              this.$message.success('批量刪除操作成功')
              this.$refs.list.init();
            }).catch(err =>{

            })
          },