Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Message): resolve marquee #1856

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/message/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export default class Message extends SuperComponent {

observers = {
marquee(val) {
if (JSON.stringify(val) === '{}') {
if (JSON.stringify(val) === '{}' || JSON.stringify(val) === 'true') {
this.setData({
marquee: {
speed: 50,
loop: -1,
delay: 5000,
delay: 0,
},
});
}
Expand Down Expand Up @@ -110,11 +110,12 @@ export default class Message extends SuperComponent {

/** 检查是否需要开启一个新的动画循环 */
checkAnimation() {
if (!this.properties.marquee) {
const { marquee } = this.properties;
if (!marquee || marquee.loop === 0) {
return;
}

const speeding = this.properties.marquee.speed;
const speeding = marquee.speed;

if (this.data.loop > 0) {
this.data.loop -= 1;
Expand Down Expand Up @@ -166,7 +167,7 @@ export default class Message extends SuperComponent {

show() {
const { duration, marquee, offset } = this.properties;
this.setData({ visible: true, loop: marquee.loop });
this.setData({ visible: true, loop: marquee.loop || this.data.loop });
this.reset();
this.checkAnimation();
if (duration && duration > 0) {
Expand Down