mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] SubmitBar: add decimal-length prop (#3151)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { use } from '../utils';
|
||||
import { emit, inherit } from '../utils/functional';
|
||||
import Button from '../button';
|
||||
import Button, { ButtonType } from '../button';
|
||||
|
||||
// Types
|
||||
import { CreateElement, RenderContext } from 'vue/types';
|
||||
@@ -13,8 +13,9 @@ export type SubmitBarProps = {
|
||||
loading?: boolean;
|
||||
currency: string;
|
||||
disabled?: boolean;
|
||||
buttonType: string;
|
||||
buttonType: ButtonType;
|
||||
buttonText?: string;
|
||||
decimalLength: number;
|
||||
};
|
||||
|
||||
export type SubmitBarSlots = DefaultSlots & {
|
||||
@@ -49,7 +50,7 @@ function SubmitBar(
|
||||
<span>{props.label || t('label')}</span>,
|
||||
<span class={bem('price')}>{`${props.currency} ${(
|
||||
(price as number) / 100
|
||||
).toFixed(2)}`}</span>
|
||||
).toFixed(props.decimalLength)}`}</span>
|
||||
]}
|
||||
</div>
|
||||
<Button
|
||||
@@ -78,6 +79,10 @@ SubmitBar.props = {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
decimalLength: {
|
||||
type: Number,
|
||||
default: 2
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
default: '¥'
|
||||
|
Reference in New Issue
Block a user