解决 cl-noticebar 等待时间过长显示的问题

This commit is contained in:
icssoa
2025-08-17 10:27:38 +08:00
parent ee75abf205
commit 7cb2014ff1

View File

@@ -16,12 +16,14 @@
}"
>
<slot name="text" :item="item">
<cl-text
:pt="{
className: parseClass(['cl-noticebar__text', pt.text?.className])
}"
>{{ item }}</cl-text
>
<view class="cl-noticebar__text">
<cl-text
:pt="{
className: parseClass(['whitespace-nowrap', pt.text?.className])
}"
>{{ item }}</cl-text
>
</view>
</slot>
</view>
</view>
@@ -159,6 +161,7 @@ function refresh() {
// 获取容器高度和宽度
const boxHeight = (box as NodeInfo).height ?? 0;
const boxWidth = (box as NodeInfo).width ?? 0;
console.log(boxWidth);
// 查询文本节点尺寸
uni.createSelectorQuery()
@@ -228,6 +231,8 @@ onUnmounted(() => {
<style lang="scss" scoped>
.cl-noticebar {
flex-shrink: 1;
&__scroller {
@apply flex;
transition-property: transform;
@@ -247,9 +252,5 @@ onUnmounted(() => {
&__item {
@apply flex flex-row items-center;
}
&__text {
white-space: nowrap;
}
}
</style>