Skip to content

SubmitBar - Vant 4

SubmitBar

Intro

Used to display the order amount and submit the order.

Install

Register component globally via app.use, refer to Component Registration for more registration ways.

js
import { createApp } from'vue'; import { SubmitBar } from'vant'; const app = createApp(); app.use(SubmitBar);

Usage

Basic Usage

html
js
import { showToast } from'vant'; exportdefault { setup() { constonSubmit = () => showToast('Submit'); return { onSubmit, }; }, };

Disabled

submit event will not triggered when disabled.

html

Loading

submit event will not triggered when loading.

html

Advanced Usage

Use slot to add custom contents.

html
js
import { showToast } from'vant'; exportdefault { setup() { constonSubmit = () => showToast('Submit'); constonClickLink = () => showToast('Click Link'); return { onSubmit, onClickLink, }; }, };

API

Props

AttributeDescriptionTypeDefault
pricePricenumber-
decimal-lengthPrice decimal length*numberstring*
labelPrice left labelstringTotal:
suffix-labelPrice right labelstring-
text-alignPrice label text align can be set to leftstringright
button-textButton textstring-
button-typeButton typestringdanger
button-colorButton colorstring-
tipTipstring-
tip-iconTip left iconstring-
currencyCurrency symbolstring��
disabledWhether to disable buttonbooleanfalse
loadingWhether to show loading iconbooleanfalse
safe-area-inset-bottomWhether to enable bottom safe area adaptationbooleantrue
placeholderWhether to generate a placeholder elementbooleanfalse

Events

EventDescriptionArguments
submitTriggered when click submit button-

Slots

NameDescription
defaultCustom left content
buttonCustom button
topCustom top content
tipCustom tips

Types

The component exports the following type definitions:

ts
importtype { SubmitBarProps, SubmitBarTextAlign } from'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-submit-bar-height50px-
--van-submit-bar-z-index100-
--van-submit-bar-backgroundvar(--van-background-2)-
--van-submit-bar-button-width110px-
--van-submit-bar-price-colorvar(--van-danger-color)-
--van-submit-bar-price-font-sizevar(--van-font-size-sm)-
--van-submit-bar-price-integer-font-size20px-
--van-submit-bar-price-fontvar(--van-price-font)-
--van-submit-bar-text-colorvar(--van-text-color)-
--van-submit-bar-text-font-sizevar(--van-font-size-md)-
--van-submit-bar-tip-paddingvar(--van-padding-xs) var(--van-padding-sm)-
--van-submit-bar-tip-font-sizevar(--van-font-size-sm)-
--van-submit-bar-tip-line-height1.5-
--van-submit-bar-tip-colorvar(--van-orange-dark)-
--van-submit-bar-tip-backgroundvar(--van-orange-light)-
--van-submit-bar-tip-icon-size12px-
--van-submit-bar-button-height40px-
--van-submit-bar-padding0 var(--van-padding-md)-

Enterprise-level mobile solution based on Vant