tanweiwei

根据项目需求,在百分比列加了sortable的排序 ,然后就发现在一直不准确

 

后来发现是排序把这个值当字符串处理了,在prop上面获取数值进行排序,显示的地方加上%就好了 

    <el-table-column
        :label="$t(\'common_pass_rate\')"
        prop="pass_rate"
        width="100"
        sortable>
        <template slot-scope="scope">
          {{scope.row.pass_rate}}% 
        </template>
      </el-table-column>

 

这样子就能正常显示了

 

 注意:重点在于,加了单位或是符号会把这个当字符串排序,所以排序的时候用数值,显示的地方加上单位或符号就好

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2022-01-02
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案