From 093afd3be27ea5e9692839845b69bd56e2405518 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期二, 13 八月 2024 23:49:45 +0800
Subject: [PATCH] 204.8.13

---
 miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
index dbd43c7..66a3a0e 100644
--- a/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
+++ b/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.js
@@ -27,14 +27,15 @@
             `${prefix}-class-suffix-icon`,
         ];
         this.options = {
-            styleIsolation: 'apply-shared',
             multipleSlots: true,
+            pureDataPattern: /^__/,
         };
         this.properties = props;
         this.data = {
             prefix,
             classPrefix: name,
             loop: -1,
+            __ready: false,
         };
         this.observers = {
             marquee(val) {
@@ -49,6 +50,8 @@
                 }
             },
             visible(visible) {
+                if (!this.data.__ready)
+                    return;
                 if (visible) {
                     this.show();
                 }
@@ -65,6 +68,8 @@
                 });
             },
             content() {
+                if (!this.data.__ready)
+                    return;
                 this.clearNoticeBarAnimation();
                 this.initAnimation();
             },
@@ -81,6 +86,7 @@
             },
             ready() {
                 this.show();
+                this.setData({ __ready: true });
             },
         };
         this.methods = {
@@ -88,7 +94,8 @@
                 const warpID = `.${name}__content-wrap`;
                 const nodeID = `.${name}__content`;
                 getAnimationFrame(this, () => {
-                    Promise.all([getRect(this, nodeID), getRect(this, warpID)]).then(([nodeRect, wrapRect]) => {
+                    Promise.all([getRect(this, nodeID), getRect(this, warpID)])
+                        .then(([nodeRect, wrapRect]) => {
                         const { marquee } = this.properties;
                         if (nodeRect == null || wrapRect == null || !nodeRect.width || !wrapRect.width) {
                             return;
@@ -108,7 +115,8 @@
                             });
                             marquee.loop !== 0 && this.startScrollAnimation(true);
                         }
-                    });
+                    })
+                        .catch(() => { });
                 });
             },
             startScrollAnimation(isFirstScroll = false) {
@@ -159,6 +167,10 @@
                     _prefixIcon: calcIcon(v, THEME_ICON[theme]),
                 });
             },
+            onChange(e) {
+                const { current, source } = e.detail;
+                this.triggerEvent('change', { current, source });
+            },
             clickPrefixIcon() {
                 this.triggerEvent('click', { trigger: 'prefix-icon' });
             },

--
Gitblit v1.9.3