fix: 修复价格显示错误
This commit is contained in:
@@ -3,6 +3,7 @@ import {useParams} from 'react-router'
|
||||
import {amisRender, commonInfo, readOnlyDialogOptions, remoteMappings} from '../../util/amis.tsx'
|
||||
import type {Schema} from 'amis'
|
||||
import {isNil} from 'es-toolkit'
|
||||
import {toNumber} from 'es-toolkit/compat'
|
||||
|
||||
const formatFinanceNumber = (value: number): string => {
|
||||
if (isNil(value)) {
|
||||
@@ -433,30 +434,28 @@ function StockDetail() {
|
||||
padding: 12,
|
||||
formatter: function (params: any) {
|
||||
const param = params[0]
|
||||
const open = param.data[0]
|
||||
const close = param.data[1]
|
||||
const lowest = param.data[2]
|
||||
const highest = param.data[3]
|
||||
const open = toNumber(param.data[1]).toFixed(2)
|
||||
const close = toNumber(param.data[2]).toFixed(2)
|
||||
const lowest = toNumber(param.data[3]).toFixed(2)
|
||||
const highest = toNumber(param.data[4]).toFixed(2)
|
||||
|
||||
return [
|
||||
`<div style="font-weight: bold; margin-bottom: 4px;">${param.name}</div>`,
|
||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
||||
`<span>开盘:</span>`,
|
||||
`<span style="margin-left: 12px; font-weight: bold;">${open}</span>`,
|
||||
`</div>`,
|
||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
||||
`<span>收盘:</span>`,
|
||||
`<span style="margin-left: 12px; font-weight: bold;">${close}</span>`,
|
||||
`</div>`,
|
||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
||||
`<span>最低:</span>`,
|
||||
`<span style="margin-left: 12px; font-weight: bold;">${lowest}</span>`,
|
||||
`</div>`,
|
||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
||||
`<span>最高:</span>`,
|
||||
`<span style="margin-left: 12px; font-weight: bold;">${highest}</span>`,
|
||||
`</div>`,
|
||||
].join('')
|
||||
return `<div class="text-center font-bold mb-2">${param.name}</div>
|
||||
<div class="text-center">
|
||||
<span>开盘:</span>
|
||||
<span class="font-bold ml-4">${open}</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<span>收盘:</span>
|
||||
<span class="font-bold ml-4">${close}</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<span>最低:</span>
|
||||
<span class="font-bold ml-4">${lowest}</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<span>最高:</span>
|
||||
<span class="font-bold ml-4">${highest}</span>
|
||||
</div>`
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
@@ -495,7 +494,7 @@ function StockDetail() {
|
||||
color: '#666',
|
||||
fontWeight: 'bold',
|
||||
formatter: function (value: number) {
|
||||
return value.toFixed(0)
|
||||
return value.toFixed(2)
|
||||
},
|
||||
},
|
||||
splitLine: {
|
||||
@@ -538,7 +537,7 @@ function StockDetail() {
|
||||
],
|
||||
},
|
||||
},
|
||||
"12月线数据"
|
||||
"12月线数据",
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user