电商组件 / 交易 / cu-shop-cart-bar 购物车栏
01 / Overview

cu-shop-cart-bar

购物车底栏容器:固定贴底,可带顶部插槽与安全区内边距,子件(图标、按钮)经默认插槽组合;组件自身不画按钮、不隐式开关子件。

交易 6 条 props 0 事件 已实现
02 / Demo

实时预览

演示页:/pages/shop/cart-bar。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。

依赖

  • 基础件:无
  • 子件:cu-shop-cart-bar-icon、cu-shop-cart-bar-button(由宿主通过默认插槽组合)
  • 实体:无
03 / Props · Events · Slots

全量契约

props

参数说明类型默认值
safeAreaInsetBottom底部补 env(safe-area-inset-bottom)booleantrue
placeholder在文档流补一段 110rpx 的等高占位块booleanfalse
customStyle根节点自定义样式(作用于贴底栏)Object{}
customClass根节点自定义类名string''
url透传字段,本件未接线string''
linkType透传字段,本件未接线string'navigateTo'

events

本件不派发事件。

slots

插槽作用域说明
top无主行上方的提示条区,无内容时不占高
default无主行,子件横向排列
04 / Example

代码示例

uvue
<cu-shop-cart-bar :safeAreaInsetBottom="true" :placeholder="true">
	<template #top><text class="bar-tip">满 199 元减 30 元</text></template>
	<cu-shop-cart-bar-icon text="购物车" icon="车" :badge="3" @click="onCart" />
	<cu-shop-cart-bar-button text="加入购物车" type="primary" @click="onAdd" />
	<cu-shop-cart-bar-button text="立即购买" type="warning" @click="onBuy" />
</cu-shop-cart-bar>
05 / Notes

注意事项

栏体是 position: fixed,不占文档流;placeholder=true 时组件自己补等高占位,宿主也可自行放占位块

安全区开启时栏体与占位块都补 env(safe-area-inset-bottom)

同一页面只挂一个吸底件(docs/01-交付与接入/限制说明.md 多实例约束);需要更多按钮就放到默认插槽里

子件必须显式组合,不靠 hasCapsuleButtons 一类隐式开关

不请求接口、不持久化、不弹 toast

安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。