This commit is contained in:
renzhijun
2026-01-31 09:52:39 +08:00
parent bb1da58a5d
commit 1bce4b8e6c

View File

@@ -635,7 +635,17 @@
conceptStocks(concept_id,{}).then(res => { conceptStocks(concept_id,{}).then(res => {
if (res.data && res.data.stocks) { if (res.data && res.data.stocks) {
// 将接口数据赋值给列表数组 // 将接口数据赋值给列表数组
this.conceptStocksList = res.data.stocks; let rawData = res.data.stocks;
// 2. 对数据进行排序处理
this.conceptStocksList = rawData.sort((a, b) => {
// 将 None 值转换为 -999
const aValue = a.change_pct === null || a.change_pct === undefined ? -999 : Number(a.change_pct);
const bValue = b.change_pct === null || b.change_pct === undefined ? -999 : Number(b.change_pct);
// 降序排列(涨幅高的在前)
return bValue - aValue;
});
} else { } else {
console.warn('接口返回数据格式异常', res); console.warn('接口返回数据格式异常', res);
} }