组件 / 数据展示 / cu-column-notice 纵向公告

cu-column-notice

纵向公告在一条窄带里轮播多条提示,可上下切换或横向滑动。

01 / Install

引入组件

整目录放进工程即用:easycom 按标签逐个解析,页面写哪个组件就只编译哪个,不写 import,也没有全局注册这一步;单个组件也可以显式引入(第 4 步,可选);主题层在 App.uvue 引入一次即可。

install
# 1  整目录放进工程(easycom 自动解析)
your-project/
└── uni_modules/
    └── colorui-x/

# 2  App.uvue 全局引入主题层(一次)
@import 'uni_modules/colorui-x/theme/base.css';
@import 'uni_modules/colorui-x/theme/layout.css';
@import 'uni_modules/colorui-x/theme/color.scss';  // 颜色工具类(.bg-* / .text-*)

# 3  页面里直接用,不写 import(只编译用到的组件)
<cu-column-notice />

# 4  单个组件也可以显式引入(可选,不用 easycom 时)
import CuColumnNotice from '@/uni_modules/colorui-x/components/cu-column-notice/cu-column-notice.uvue'

组件样式自包含(只依赖包内 token.scss),主题层是给页面工具类用的,不参与组件注册。两种安装方式见 快速上手。

02 / Platform

平台支持

AndroidiOSHarmonyOSWeb(H5)微信小程序支付宝小程序
√ — — √ — —

Android 列取自本仓真机逐屏判定(√ 已验 / — 待复核 / × 已登记缺陷,本件当前为「真机已验」)。

Web 列只表示已编出可运行的预览产物,非真机渲染。

其余三端没有任何实测证据,不作支持承诺。

03 / Demo

代码演示

01

默认

uvue
<cu-column-notice :text="three" @click="onClick" @close="onClose" />
02

文案边界

uvue
<cu-column-notice :text="empty" @click="onClick" />
<cu-column-notice :text="one" @click="onClick" />
<cu-column-notice :text="longOne" @click="onClick" />
<cu-column-notice :text="mixed" @click="onClick" />
03

方向

uvue
<cu-column-notice :text="three" :step="false" :duration="1200" @click="onClick" />
<cu-column-notice :text="three" :step="true" :duration="1200" @click="onClick" />
04

间隔

uvue
<cu-column-notice :text="three" :duration="500" @click="onClick" />
<cu-column-notice :text="three" @click="onClick" />
<cu-column-notice :text="three" :duration="4000" @click="onClick" />
<cu-column-notice :text="three" :duration="0" @click="onClick" />
05

锁定滑动

uvue
<cu-column-notice :text="three" :disableTouch="true" @click="onClick" />
<cu-column-notice :text="three" :disableTouch="false" @click="onClick" />
06

模式

uvue
<cu-column-notice :text="three" mode="link" @click="onClick" />
<cu-column-notice :text="three" mode="closable" @click="onClick" @close="onClose" />
<cu-column-notice :text="three" mode="close" @click="onClick" />
07

颜色 / 图标

uvue
<cu-column-notice :text="three" color="#0081ff" icon="cuIcon-warnfill" mode="link" @click="onClick" />
<cu-column-notice :text="three" color="" icon="" @click="onClick" />
08

字号

uvue
<cu-column-notice :text="three" :fontSize="12" @click="onClick" />
<cu-column-notice :text="three" :fontSize="20" @click="onClick" />
09

未消费项

uvue
<cu-column-notice :text="three" bgColor="#fadbd9" :speed="30" url="/pages/base/cu-grid" linkType="navigateTo" @click="onClick" />
10

自定义 / 插槽

uvue
<cu-column-notice :text="three" :customStyle="colStyle" customClass="custom-class" @click="onClick">
  <template v-slot:icon>
    <text>
      告
    </text>
  </template>
</cu-column-notice>
11

取值与事件

这一节的交互由演示页脚本驱动,效果见右侧实时预览。

04 / Props · Events · Slots

全量 API

props

参数说明类型默认值
内容
text轮播文案数组,逐项渲染为一条;空数组时只有图标Array(): Array<any> => []
icon左侧图标名,取 cu-icon 白名单;空串不渲染左图标String'cuIcon-notificationfill'
轮播与右侧动作
modelink 在右侧画箭头 / closable 画关闭按钮并抛 close;空串两侧都不加String''
steptrue ⇒ 横向轮播;默认竖向逐条上移Booleanfalse
duration每条停留时长,毫秒;直接作为轮播间隔Number1500
disableTouchtrue ⇒ 锁住手势,只能自动轮播Booleantrue
文字样式
color文案与图标颜色;空串走 token 默认String''
fontSize文案字号,px 契约值;运行时 ×2 换算成 rpxNumber14
交互与样式
customStyle根节点内联样式Object(): UTSJSONObject => ({})
customClass追加到根节点的类名String''
声明保留但不被消费
bgColor整条底色;本仓不读取,传参不生效String''
speed滚动速率;本仓不读取,轮播节奏由 duration 决定Number80
url不产生跳转,请在 click 里自行跳转String''
linkType不产生跳转,同上String'navigateTo'

events

事件说明类型默认值平台差异说明
@click点击整条通知时触发,回传当前轮播项的索引(从 0 起)Handler-各端一致
@close点右侧关闭按钮时触发,无载荷;组件不自行隐藏,需宿主移除该条Handler-各端一致

slots

slot说明
icon自定义左侧图标内容;不填时按 icon 渲染,icon 为空则整块不渲染
05 / Notes

注意事项

长文案被裁 :轮播区高度固定为一行,每条文案超出一行就被裁掉且不加省略号;文案按一行长度裁写,别指望它换行或给省略提示。