[new feature] SubmitBar: add decimal-length prop (#3151)

This commit is contained in:
neverland
2019-04-15 17:59:56 +08:00
committed by GitHub
parent ae73af819d
commit ffe82e2f06
6 changed files with 40 additions and 8 deletions

View File

@@ -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: '¥'