mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
perf(TableList): 优化列表项数据格式化处理
- 增加对 valueFormatter 函数类型的判断,提高数据格式化处理的灵活性和安全性 - 优化数据排序逻辑,提高列表项数据的准确性和可靠性 - 修复部分变量命名和赋值问题,提升代码质量和可维护性
This commit is contained in:
parent
3b5e0fcdeb
commit
8bfeca26c7
@ -10,7 +10,11 @@
|
||||
<div class="rank" :style="`color: ${color};font-size: ${indexFontSize}px`">No.{{ item.ranking }}</div>
|
||||
<div class="info-name" :style="`font-size: ${leftFontSize}px`" v-html="item.name" />
|
||||
<div class="ranking-value" :style="`color: ${textColor};font-size: ${rightFontSize}px`">
|
||||
{{ status.mergedConfig.valueFormatter ? status.mergedConfig.valueFormatter(item) : item.value }}
|
||||
{{
|
||||
typeof status.mergedConfig.valueFormatter === 'function'
|
||||
? status.mergedConfig.valueFormatter(item)
|
||||
: item.value
|
||||
}}
|
||||
{{ unit }}
|
||||
</div>
|
||||
</div>
|
||||
@ -62,7 +66,8 @@ const status = reactive({
|
||||
const calcRowsData = () => {
|
||||
let { dataset, rowNum, sort } = status.mergedConfig
|
||||
// @ts-ignore
|
||||
sort &&dataset.sort(({ value: a }, { value: b } ) => {
|
||||
sort &&
|
||||
dataset.sort(({ value: a }, { value: b }) => {
|
||||
if (a > b) return -1
|
||||
if (a < b) return 1
|
||||
if (a === b) return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user