import { use, noop } from '../utils'; import { inherit } from '../utils/functional'; import Button from '../button'; const [sfc, bem, t] = use('submit-bar'); function SubmitBar(h, props, slots, ctx) { const { tip, price } = props; const hasPrice = typeof price === 'number'; return (
{slots.top && slots.top()} {(slots.tip || tip) && (
{tip} {slots.tip && slots.tip()}
)}
{slots.default && slots.default()}
{hasPrice && [ {props.label || t('label')}, {`${props.currency} ${( price / 100 ).toFixed(2)}`} ]}
); } SubmitBar.props = { tip: String, label: String, loading: Boolean, disabled: Boolean, buttonText: String, price: { type: Number, default: null }, currency: { type: String, default: '¥' }, buttonType: { type: String, default: 'danger' } }; export default sfc(SubmitBar);