完整用法
App 端 sticky 不生效,退为静态容器
<cu-sticky> <text> 默认档:bgColor=transparent → 应无底色,只有文字 </text> </cu-sticky> <cu-sticky bgColor="#39b54a"> <text> 实色底:#39b54a 经内联生效(prop 色不走 token) </text> </cu-sticky> <cu-sticky bgColor=""> <text> bgColor 传空串 → 拼出 background-color:; 应回落无底色且不报错 </text> </cu-sticky> <cu-sticky :disabled="true" bgColor="#f37b1d"> <text> disabled=true → position:static(参考实现 :64),底色仍应生效 </text> </cu-sticky> <cu-sticky> <text> S1 默认档:top 0,无底色 → 应第一个粘在容器顶 </text> </cu-sticky> <cu-sticky :offsetTop="50"> <text> S2 offsetTop=50 → top:100rpx </text> </cu-sticky> <cu-sticky :offsetTop="100"> <text> S3 offsetTop=100 → top:200rpx </text> </cu-sticky> <cu-sticky :customNavHeight="60" :offsetTop="40" zIndex="9999"> <text> S4 customNavHeight 60 + offsetTop 40 → 同为 top:200rpx,且 zIndex=9999 → 应与 S3 重合并盖住它(S4 可见) </text> </cu-sticky> <cu-sticky :offsetTop="150" zIndex="1" bgColor="#e54d42"> <text> S5 offsetTop=150 → 300rpx,zIndex='1'(比默认的 970 低) </text> </cu-sticky> <cu-sticky :offsetTop="150" bgColor="#0081ff"> <text> S6 同 top 300rpx、zIndex 留空 → 970,应盖住 S5 </text> </cu-sticky> <cu-sticky :disabled="true" bgColor="#6739b6"> <text> S7 disabled=true → static,应随流滚走、绝不粘顶 </text> </cu-sticky> <cu-sticky bgColor=""> <text> S8 bgColor 空串(top 0)→ 应无底色但仍吸附 </text> </cu-sticky> <cu-sticky index="X"> <text> S9 传 index='X'(声明未消费)→ 应与 S1 同形(top 0、无底色) </text> </cu-sticky> <cu-sticky> <!-- 空槽:本格不给任何内容,用来验 sticky 是否能零高且不报错 --> </cu-sticky> <cu-sticky :customStyle="boxStyle" customClass="custom-class" :offsetTop="200"> <text> S10 customStyle(左右内距 20rpx)+ customClass(页面侧圆角)→ top:400rpx </text> </cu-sticky> <cu-sticky :offsetTop="250" bgColor="#f1f1f1"> <text> S11 超长文案:这是一段用来观察吸顶容器是否会限制内容换行的超长文案,超长文案继续重复直到撑满整行并触发换行,本仓未给本件任何宽高与截断声明(参考实现同形),文字应正常换行而容器随内容长高。 </text> </cu-sticky> <cu-sticky :offsetTop="0"> <text> S12 嵌套:外层 sticky(top 0),内层再套一个 sticky </text> <cu-sticky :offsetTop="60" bgColor="#cce6ff"> <text> S12-in 内层 sticky top:120rpx(App 端嵌套 sticky 的包含块语义未实测 → 只登记现象) </text> </cu-sticky> </cu-sticky> <cu-sticky :offsetTop="400"> <text> S13 offsetTop=400 → 800rpx:本行用来确认 top 超过视口一半时的表现,且它应比 S1~S11 都低 </text> </cu-sticky>