mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-17 18:47:29 +08:00
🦄 refactor: 重构代码将 Vuex替换为 Pinia
集成 Pinia 状态管理
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export const useSearchStore = defineStore('search', () => {
|
||||
const searchValue = ref('');
|
||||
const searchType = ref(1);
|
||||
|
||||
const setSearchValue = (value: string) => {
|
||||
searchValue.value = value;
|
||||
};
|
||||
|
||||
const setSearchType = (type: number) => {
|
||||
searchType.value = type;
|
||||
};
|
||||
|
||||
return {
|
||||
searchValue,
|
||||
searchType,
|
||||
setSearchValue,
|
||||
setSearchType
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user