fix:修复浅拷贝数组问题

This commit is contained in:
2026-06-10 12:11:55 +08:00
parent 97af0505b2
commit ea05b8ff43
5 changed files with 70 additions and 49 deletions
+11 -5
View File
@@ -98,16 +98,20 @@ const defaultAvatarConfig = {
option: '0',
}
const defaultOathConfig = {
const createDefaultOathConfig = (): IConfigOath => ({
id: '',
adaptation: 0,
upgrade: [0, 0, 0, 0],
}
})
const defaultEmblemConfig = {
const defaultOathConfig = createDefaultOathConfig()
const createDefaultEmblemConfig = (): IConfigEmblem => ({
lv: 0,
items: ['', '', '', '', '', ''],
}
})
const defaultEmblemConfig = createDefaultEmblemConfig()
export const useConfigStore = defineStore('configStore', () => {
const config = ref<IConfig>({
@@ -194,7 +198,7 @@ export const useConfigStore = defineStore('configStore', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
config.value &&
!config.value?.oaths.hasOwnProperty(p) &&
(config.value.oaths[p.toString()] = { ...defaultOathConfig })
(config.value.oaths[p.toString()] = createDefaultOathConfig())
})
infoStore.options.forEach((option) => {
@@ -284,6 +288,8 @@ export const useConfigStore = defineStore('configStore', () => {
defaultEqusConfig,
defaultAvatarConfig,
defaultOathConfig,
createDefaultOathConfig,
defaultEmblemConfig,
createDefaultEmblemConfig,
}
})