mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(SubmitBar): fix decimal-length bug (#5224)
This commit is contained in:
parent
41824d7afa
commit
00c4e488c9
@ -41,12 +41,17 @@ function SubmitBar(
|
||||
function Text() {
|
||||
if (typeof price === 'number') {
|
||||
const priceArr = (price / 100).toFixed(props.decimalLength).split('.');
|
||||
const decimalStr = props.decimalLength ? `.${priceArr[1]}` : '';
|
||||
return (
|
||||
<div style={{ textAlign: props.textAlign ? props.textAlign : '' }} class={bem('text')}>
|
||||
<div
|
||||
style={{ textAlign: props.textAlign ? props.textAlign : '' }}
|
||||
class={bem('text')}
|
||||
>
|
||||
<span>{props.label || t('label')}</span>
|
||||
<span class={bem('price')}>
|
||||
{props.currency}
|
||||
<span class={bem('price', 'integer')}>{priceArr[0]}</span>.{priceArr[1]}
|
||||
<span class={bem('price', 'integer')}>{priceArr[0]}</span>
|
||||
{decimalStr}
|
||||
</span>
|
||||
{props.suffixLabel && (
|
||||
<span class={bem('suffix-label')}>{props.suffixLabel}</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user