feat: 添加 lx 音源导入

This commit is contained in:
alger
2025-12-13 15:00:38 +08:00
parent b9287e1c36
commit 89c6b11110
14 changed files with 1569 additions and 123 deletions
+10 -2
View File
@@ -1,4 +1,4 @@
import { cloneDeep, merge } from 'lodash';
import { cloneDeep, isArray, mergeWith } from 'lodash';
import { defineStore } from 'pinia';
import { ref, watch } from 'vue';
@@ -55,8 +55,16 @@ export const useSettingsStore = defineStore('settings', () => {
? window.electron.ipcRenderer.sendSync('get-store-value', 'set')
: JSON.parse(localStorage.getItem('appSettings') || '{}');
// 自定义合并策略:如果是数组,直接使用源数组(覆盖默认值)
const customizer = (_objValue: any, srcValue: any) => {
if (isArray(srcValue)) {
return srcValue;
}
return undefined;
};
// 合并默认设置和保存的设置
const mergedSettings = merge({}, setDataDefault, savedSettings);
const mergedSettings = mergeWith({}, setDataDefault, savedSettings, customizer);
// 更新设置并返回
setSetData(mergedSettings);