报错[Vue warn]:Invalid prop:custom validator check failed for prop "percentage"

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
}

 

posted on 2021-01-01 18:33  Mike17  阅读(5016)  评论(0编辑  收藏  举报

导航

搜狗