未验证 提交 a610fcd1 编写于 作者: Y yangxiaolu1993 提交者: GitHub

fix(NoticeBar): speed、height 设置为某些值时,不触发滚动问题 (#894)

* feat: sku

* feat: 可配置颜色提出

* feat: prop 调整

* fix: noticebar 极限值报错问题修改
上级 80a9a858
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
<view class="nut-cd-dot"></view> <view class="nut-cd-dot"></view>
</template> </template>
<view class="nut-cd-block">{{ resttime.h }}</view <view class="nut-cd-block">{{ resttime.h }}</view
><view class="nut-cd-dot">:</view ><view class="nut-cd-dot">:</view><view class="nut-cd-block">{{ resttime.m }}</view
><view class="nut-cd-block">{{ resttime.m }}</view ><view class="nut-cd-dot">:</view><view class="nut-cd-block">{{ resttime.s }}</view>
><view class="nut-cd-dot">:</view
><view class="nut-cd-block">{{ resttime.s }}</view>
</template> </template>
</view> </view>
</template> </template>
...@@ -73,7 +71,7 @@ export default create({ ...@@ -73,7 +71,7 @@ export default create({
} }
}, },
components: {}, components: {},
emits: ['input', 'on-end', 'on-restart', 'on-paused'], emits: ['input', 'on-end', 'on-restart', 'on-paused', 'update:modelValue'],
setup(props, { emit, slots }) { setup(props, { emit, slots }) {
console.log('componentName', componentName); console.log('componentName', componentName);
...@@ -209,10 +207,7 @@ export default create({ ...@@ -209,10 +207,7 @@ export default create({
const d = ts >= ds ? parseInt(ts / ds) : 0; const d = ts >= ds ? parseInt(ts / ds) : 0;
const h = ts - d * ds >= hs ? parseInt((ts - d * ds) / hs) : 0; const h = ts - d * ds >= hs ? parseInt((ts - d * ds) / hs) : 0;
const m = const m = ts - d * ds - h * hs >= ms ? parseInt((ts - d * ds - h * hs) / ms) : 0;
ts - d * ds - h * hs >= ms
? parseInt((ts - d * ds - h * hs) / ms)
: 0;
const s = Math.round((ts - d * ds - h * hs - m * ms) / 1000); const s = Math.round((ts - d * ds - h * hs - m * ms) / 1000);
if (d >= 0) rest.d = d + ''; if (d >= 0) rest.d = d + '';
......
...@@ -8,26 +8,14 @@ ...@@ -8,26 +8,14 @@
@click="handleClick" @click="handleClick"
v-if="direction == 'across'" v-if="direction == 'across'"
> >
<view <view class="left-icon" v-if="iconShow" :style="{ 'background-image': `url(${iconBg})` }">
class="left-icon" <nut-icon name="notice" size="16" :color="color" v-if="!iconBg"></nut-icon>
v-if="iconShow"
:style="{ 'background-image': `url(${iconBg})` }"
>
<nut-icon
name="notice"
size="16"
:color="color"
v-if="!iconBg"
></nut-icon>
</view> </view>
<view ref="wrap" class="wrap"> <view ref="wrap" class="wrap">
<view <view
ref="content" ref="content"
class="content" class="content"
:class="[ :class="[animationClass, { 'nut-ellipsis': !scrollable && !wrapable }]"
animationClass,
{ 'nut-ellipsis': !scrollable && !wrapable }
]"
:style="contentStyle" :style="contentStyle"
@animationend="onAnimationEnd" @animationend="onAnimationEnd"
@webkitAnimationEnd="onAnimationEnd" @webkitAnimationEnd="onAnimationEnd"
...@@ -40,11 +28,7 @@ ...@@ -40,11 +28,7 @@
</view> </view>
</view> </view>
<view <view class="nut-noticebar-vertical" v-if="scrollList.length > 0 && direction == 'vertical'" :style="barStyle">
class="nut-noticebar-vertical"
v-if="scrollList.length > 0 && direction == 'vertical'"
:style="barStyle"
>
<template v-if="slots.default"> <template v-if="slots.default">
<view class="horseLamp_list" :style="horseLampStyle"> <view class="horseLamp_list" :style="horseLampStyle">
<ScrollItem <ScrollItem
...@@ -237,8 +221,9 @@ export default create({ ...@@ -237,8 +221,9 @@ export default create({
}; };
} else { } else {
if (state.animate) { if (state.animate) {
let a = ~~(props.height / props.speed / 4);
styles = { styles = {
transition: `all ${~~(props.height / props.speed / 4)}s`, transition: `all ${a == 0 ? ~~(props.height / props.speed) : a}s`,
'margin-top': `-${props.height}px` 'margin-top': `-${props.height}px`
}; };
} }
...@@ -306,10 +291,7 @@ export default create({ ...@@ -306,10 +291,7 @@ export default create({
*/ */
const startRollEasy = () => { const startRollEasy = () => {
showhorseLamp(); showhorseLamp();
(state.timer as any) = setInterval( (state.timer as any) = setInterval(showhorseLamp, ~~((props.height / props.speed / 4) * 1000) + props.standTime);
showhorseLamp,
~~(props.height / props.speed / 4) * 1000 + props.standTime
);
}; };
const showhorseLamp = () => { const showhorseLamp = () => {
state.animate = true; state.animate = true;
...@@ -317,7 +299,7 @@ export default create({ ...@@ -317,7 +299,7 @@ export default create({
state.scrollList.push(state.scrollList[0]); state.scrollList.push(state.scrollList[0]);
state.scrollList.shift(); state.scrollList.shift();
state.animate = false; state.animate = false;
}, ~~(props.height / props.speed / 4) * 1000); }, ~~((props.height / props.speed / 4) * 1000));
}; };
const startRoll = () => { const startRoll = () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册