1.html部分

        <el-table-column prop="userzb" label="用户占比">
          <template solt-scope="scope" v-if="btnType === 1">
            <el-progress v-if="scope.row.userzb" :percentage="filterData(scope.row.userzb)" color=""></el-progress>
          </template>
        </el-table-column>

2.js部分

filterData(val){
  //百分比必须为0-100,否则报错[Vue warn]:Invalid prop:custom validator check failed for prop "percentage"
  let result = 0
  if(val >0&&(val<=1)){
    result = parseFloat((val * 100).toPrecision(12))
  }
  return result
}

 

相关文章: