Skip to content

SubmitBar Order Submission Bar Component ​

The SubmitBar order submission bar is a core functional component for e-commerce applications. It is mainly used at the bottom of product detail pages, providing a quick action bar that guides users through the purchase process. The component supports extensive customization options, allowing styles and functionality to be flexibly adjusted according to business requirements.

Component Description

This component is a core business component for e-commerce apps. It provides a complete bottom action bar solution, with multi-platform support and rich interaction customization.

📌 Platform Differences ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

Component Features ​

  • Fixed Bottom: The component is fixed to the bottom of the page by default, ensuring the action entry is always visible
  • Custom Styles: Rich customization options for button color, text, shape, and more, with gradient color support
  • Icons & Badges: Supports configuring left-side menu icons, with badges to indicate new messages or product quantities
  • Flexible Layout: Supports showing/hiding the left and right buttons, as well as customizing content via slots

🏯 Basic Usage Example ​

html
<!-- Global usage -->
<hy-submit-bar :menus="menus"></hy-submit-bar>
ts
import { reactive } from 'vue';
import { IconConfig } from 'hy-app'; // Import icon configuration

const menus = reactive([
    { icon: IconConfig.HOME, text: 'Home' },
    { icon: IconConfig.CUSTOMER_SERVICE, text: 'Customer Service' },
    {
        icon: IconConfig.SHOPPING_CART,
        text: 'Shopping Cart',
        badge: { value: 10 },
    },
]);

Hiding Buttons ​

  • Hide the left button by setting show-left-btn
  • Hide the right button by setting show-right-btn
html
<!-- Hide the left button -->
<hy-submit-bar :menus="menus" :show-left-btn="false"></hy-submit-bar>
<!-- Hide the right button -->
<hy-submit-bar :menus="menus" :show-right-btn="false"></hy-submit-bar>
ts
import { HySubmitBar } from 'hy-app';
import { reactive } from 'vue';
import { IconConfig } from 'hy-app';

const menus = reactive([
    { icon: IconConfig.HOME, text: 'Home' },
    { icon: IconConfig.CUSTOMER_SERVICE, text: 'Customer Service' },
    { icon: IconConfig.SHOPPING_CART, text: 'Shopping Cart' },
]);

Defining Button Styles ​

  • Set the button text color via textColor
  • Set the left button text via leftBtnText
  • Set the right button text via rightBtnText
  • Set the left button color via leftBtnColor
  • Set the right button color via rightBtnColor
  • Set the button shape via shape
    • circle semicircle
    • square square
html
<!-- Custom button style example -->
<hy-submit-bar
    :menus="menus"
    textColor="#FFFFFF"
    left-btn-text="Buy"
    left-btn-color="linear-gradient(to right, #4bfcfc, #FB39F5)"
    shape="circle"
></hy-submit-bar>

<!-- Different button shape example -->
<hy-submit-bar
    :menus="menus"
    textColor="#FFFFFF"
    right-btn-text="Place Order"
    right-btn-color="linear-gradient(to right, #23ee2c, #FB39F5)"
    shape="square"
></hy-submit-bar>
ts
import { HySubmitBar } from 'hy-app';
import { reactive } from 'vue';
import { IconConfig } from 'hy-app';

const menus = reactive([
    { icon: IconConfig.HOME, text: 'Home' },
    { icon: IconConfig.CUSTOMER_SERVICE, text: 'Customer Service' },
    { icon: IconConfig.SHOPPING_CART, text: 'Shopping Cart' },
]);

Right Icon Content Settings ​

  • Define the icon, text, and badge value (style) by setting the items in menus
    • icon icon from the icon library
    • text text content
    • badge badge value, see the Badge API for usage
  • Set the icon color via iconColor
  • Set the text color via iconLabelColor
html
<!-- Custom icons and badges -->
<hy-submit-bar :menus="menus" iconColor="#ff6b8b" iconLabelColor="#666666"></hy-submit-bar>

<!-- Hide the left button -->
<hy-submit-bar :menus="menus" :show-left-btn="false"></hy-submit-bar>
ts
import { HySubmitBar } from 'hy-app';
import { reactive } from 'vue';
import { IconConfig } from 'hy-app';

const menus = reactive([
    { icon: IconConfig.HOME, text: 'Home' },
    { icon: IconConfig.CUSTOMER_SERVICE, text: 'Customer Service' },
    {
        icon: IconConfig.SHOPPING_CART,
        text: 'Shopping Cart',
        badge: { value: 10, type: 'success' },
    },
]);

API ​

SubmitBar Props ​

ParameterDescriptionTypeDefault
menusLeft menu barSubmitBarIconMenus[]-
fixedWhether to fix to the bottombooleantrue
borderWhether to show the top borderbooleantrue
leftLoadingShow loading on the left buttonbooleanfalse
rightLoadingShow loading on the right buttonbooleanfalse
iconColorColor of the left iconsstring-
iconLabelColorColor of the left textstring#909193FF
textColorText color of the right buttonsstring-
showLeftBtnWhether to show the left buttonbooleantrue
showRightBtnWhether to show the right buttonbooleantrue
leftBtnTextLeft button textstringAdd to Cart
rightBtnTextRight button textstringBuy Now
leftBtnColorLeft button color, supports gradient colorsstring#ed3f14
rightBtnColorRight button color, supports gradient colorsstring#ff7900
shapeShape of the buttonscircle|squarecircle
warnButton click throttle duration (unit: ms)number300
customStyleExternal styles to be appliedCSSProperties-

Events ​

Event NameDescriptionCallback Parameters
clickTriggered when a button is clickedindex: number
menuClickTriggered when a left menu item is clickedtemp: SubmitBarIconMenus, index: number

Slots ​

Slot NameDescriptionAccepted Values
leftCustom content on the left-
rightCustom content on the right-

Typings ​

Type Definitions
ts
export interface SubmitBarIconMenus {
    /**
     * Icon
     * */
    icon: string;
    /**
     * Text
     * */
    text: string;
    /**
     * Badge value
     * */
    badge?: BadgeProps['badge'];
    [key: string]: any;
}

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-submit-bar-left-font-sizeLeft text font size20rpx
--hy-submit-bar-right-font-sizeRight price font size26rpx
--hy-submit-bar-right-widthRight area width400rpx
12:33
battery