🦄 refactor: 重构代码将 Vuex替换为 Pinia

集成 Pinia 状态管理
This commit is contained in:
alger
2025-03-19 22:48:28 +08:00
parent 4fa5ed0ca6
commit e355341596
40 changed files with 1170 additions and 494 deletions
+7 -4
View File
@@ -131,7 +131,6 @@
import { useDebounceFn } from '@vueuse/core';
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStore } from 'vuex';
import LyricSettings from '@/components/lyric/LyricSettings.vue';
import {
@@ -143,6 +142,8 @@ import {
textColors,
useLyricProgress
} from '@/hooks/MusicHook';
import { usePlayerStore } from '@/store/modules/player';
import { useSettingsStore } from '@/store/modules/settings';
import { getImgUrl, isMobile } from '@/utils';
import { animateGradient, getHoverBackgroundColor, getTextColors } from '@/utils/linearColor';
@@ -372,13 +373,15 @@ onBeforeUnmount(() => {
}
});
const store = useStore();
const playerStore = usePlayerStore();
const settingsStore = useSettingsStore();
const handleArtistClick = (id: number) => {
isVisible.value = false;
store.commit('setCurrentArtistId', id);
settingsStore.currentArtistId = id;
};
const setData = computed(() => store.state.setData);
const setData = computed(() => settingsStore.setData);
// 监听字体变化并更新 CSS 变量
watch(