浏览代码

fix:高亮

liushengqiang 2 年之前
父节点
当前提交
33917d40f3
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 3 3
      src/components/TheNoticeBar/index.tsx
  2. 2 1
      src/components/layout/layoutSilder.tsx

+ 3 - 3
src/components/TheNoticeBar/index.tsx

@@ -23,7 +23,7 @@ export default defineComponent({
       time: null as any
     });
     const init = () => {
-      if (notiData.isActive) return;
+      if (notiData.isActive || !contentRef.value || !wrapRef.value) return;
       notiData.isActive = true;
       notiData.contentWidth = contentRef.value.getBoundingClientRect().width;
       notiData.wrapWidth = wrapRef.value.getBoundingClientRect().width;
@@ -43,8 +43,8 @@ export default defineComponent({
         notiData.contentStyle.transitionDuration = '0s';
         notiData.contentStyle.transform = `translateX(${notiData.wrapWidth}px)`;
         requestAnimationFrame(() => {
-            startAnimate();
-        })
+          startAnimate();
+        });
       }, 5 * 1000);
     };
     const stopAnimate = () => {

+ 2 - 1
src/components/layout/layoutSilder.tsx

@@ -62,6 +62,7 @@ export default defineComponent({
         normalIcon: kuNormal,
         isActive: false,
         id: 5,
+        lightList:[ '/xiaoku-music'],//小酷AI的灯光列表
         path: '/xiaoku-ai'
       },
       {
@@ -100,7 +101,7 @@ export default defineComponent({
     const checkPathChange = (path: string) => {
       itemInfoList.forEach((now: any) => {
         now.isActive = false;
-        if (now.path === path) {
+        if (now.path === path || now.lightList?.includes(path)) {
           now.isActive = true;
         }
       });