element文件上傳增加進度條


template里代碼如下:

    <div class="loadingModal" :style="{'height':'100%'}" v-if="progressLoading">
         <el-progress
            :stroke-width="20"
            style="width:500px;margin-left:-250px;position: absolute;top: 50%;left: 50%;"
            :text-inside="true"
            :percentage="percentage"
            :color="colors"
            :status="percentage === 100?undefined:'success'"
        ></el-progress>
       </div>

 methods代碼:

start() {
   const that = this;
   that.$nextTick(() => {
      that.progressLoading = true;
      that.percentage = 0;
      that.timeStart = setInterval(() => {
         if (that.percentage < 95) {
             that.percentage += 1;
         }
      }, 100);
   });
},
// 進度條結束
end() {
   const that = this;
   that.percentage = 100;
   clearInterval(this.timeStart);
   setTimeout(() => {
       that.progressLoading = false;
   }, 300);
},

  data參數:

progressLoading:false,
percentage:0,
colors:"#1e9f4c ",//顏色自己規定

  css代碼

.loadingModal {
  width: 100%;
  margin: 0 auto;
  background: rgba(22, 21, 21, 0.3);
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 999999;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM