提交
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user