根據項目需求,在百分比列加了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>
這樣子就能正常顯示了
注意:重點在於,加了單位或是符號會把這個當字符串排序,所以排序的時候用數值,顯示的地方加上單位或符號就好