Jelajahi Sumber

增加乐团颜色无限

liushengqiang 1 tahun lalu
induk
melakukan
b5442312cb
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      src/views/home/component/MusicGroup.tsx

+ 6 - 2
src/views/home/component/MusicGroup.tsx

@@ -74,17 +74,21 @@ export default defineComponent({
       const _list = Array.from(
         new Set(data.value.map(item => item.musicGroupName))
       );
+      let index = 0;
       const obj: { [_key: string]: { text: string; color: string } } =
         _list.reduce(
           (
             obj: { [_key: string]: { text: string; color: string } },
-            value: string,
-            index: number
+            value: string
           ) => {
+            if (index > colors.length - 1) {
+              index = 0;
+            }
             obj[value] = {
               text: value,
               color: colors[index]
             };
+            index++;
             return obj;
           },
           {}