修复: 设置页和分离窗口渲染崩溃(TDZ + 窗口权限通配符)
- AdvancedSection clampApprovalTimeout 常量移到 reactive 之前(打包后 const 初始化顺序 TDZ) - @/i18n 去掉对 @/stores/appSettings 的 import,改直读 localStorage - Tauri capability 加 ai-detached-* / fe-detached-* 通配符(分离窗口 listen 权限)
This commit is contained in:
@@ -43,8 +43,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, watch, onMounted, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useAppSettingsStore } from '@/stores/appSettings'
|
||||
import i18n from '@/i18n'
|
||||
import SettingRow from './SettingRow.vue'
|
||||
|
||||
// ============================================================
|
||||
@@ -53,6 +53,7 @@ import SettingRow from './SettingRow.vue'
|
||||
// 阶段5:SettingRow 封装行布局,控件变更后调 markSaved 显"已保存"
|
||||
// ============================================================
|
||||
const appSettings = useAppSettingsStore()
|
||||
const { locale } = useI18n()
|
||||
|
||||
const settings = reactive({
|
||||
theme: appSettings.get<string>('df-theme', 'dark'),
|
||||
@@ -107,7 +108,7 @@ watch(() => settings.streamingMd, (val) => {
|
||||
watch(() => settings.language, (val) => {
|
||||
void appSettings.set('df-language', val)
|
||||
// 同步 i18n 实例,让界面立即跟随语言切换
|
||||
i18n.global.locale.value = val as 'zh-CN' | 'en'
|
||||
locale.value = val as 'zh-CN' | 'en'
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user