| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
- import { use } from '../utils';
- import { emit, inherit } from '../utils/functional';
- import Button from '../button'; // Types
- var _use = use('submit-bar'),
- sfc = _use[0],
- bem = _use[1],
- t = _use[2];
- function SubmitBar(h, props, slots, ctx) {
- var tip = props.tip,
- price = props.price;
- var hasPrice = typeof price === 'number';
- return h("div", _mergeJSXProps([{
- "class": bem({
- 'safe-area-inset-bottom': props.safeAreaInsetBottom
- })
- }, inherit(ctx)]), [slots.top && slots.top(), (slots.tip || tip) && h("div", {
- "class": bem('tip')
- }, [tip, slots.tip && slots.tip()]), h("div", {
- "class": bem('bar')
- }, [slots["default"] && slots["default"](), h("div", {
- "class": bem('text')
- }, [hasPrice && [h("span", [props.label || t('label')]), h("span", {
- "class": bem('price')
- }, [props.currency + " " + (price / 100).toFixed(props.decimalLength)])]]), h(Button, {
- "attrs": {
- "square": true,
- "size": "large",
- "type": props.buttonType,
- "loading": props.loading,
- "disabled": props.disabled,
- "text": props.loading ? '' : props.buttonText
- },
- "on": {
- "click": function click() {
- emit(ctx, 'submit');
- }
- }
- })])]);
- }
- SubmitBar.props = {
- tip: String,
- label: String,
- loading: Boolean,
- disabled: Boolean,
- buttonText: String,
- safeAreaInsetBottom: Boolean,
- price: {
- type: Number,
- "default": null
- },
- decimalLength: {
- type: Number,
- "default": 2
- },
- currency: {
- type: String,
- "default": '¥'
- },
- buttonType: {
- type: String,
- "default": 'danger'
- }
- };
- export default sfc(SubmitBar);
|