20260917212907
This commit is contained in:
1 parent
6fa3d8535e
commit
5cbf745bbf
115 files changed
+4104
-85
No files matched your search
@@ -1,10 +1,32 @@
|
||||
<script setup>
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
import { defineAsyncComponent, watch } from 'vue'
|
||||
import { setUIConfig } from '@/components/ui'
|
||||
import { useI18nStore } from '@/stores/i18n'
|
||||
|
||||
// 业务应用入口:仅渲染当前路由页面
|
||||
// FPS 性能监控浮层全环境挂载(生产环境同样用于现场性能排查);
|
||||
// 仍走异步组件,单独分包,不进主包
|
||||
const FpsMonitor = defineAsyncComponent(() => import('@/components/FpsMonitor.vue'))
|
||||
|
||||
// 表单布局随语言:中文横排(label 在左、控件在右,节省纵向空间),
|
||||
// 其他语言标签更长,竖排(label 在上)避免 label 挤压控件。
|
||||
// 写在应用根上,locale 已持久化,刷新后由 immediate 立即同步一次。
|
||||
const i18nStore = useI18nStore()
|
||||
|
||||
function formLayoutOf(locale) {
|
||||
const isChinese = /^zh/i.test(String(locale || ''))
|
||||
return isChinese ? 'horizontal' : 'vertical'
|
||||
}
|
||||
|
||||
watch(
|
||||
() => i18nStore.locale,
|
||||
(locale) => {
|
||||
setUIConfig({ form: { layout: formLayoutOf(locale) } })
|
||||
// 译文跟着语言走:内置文案兜底,接口失败也不阻断渲染
|
||||
i18nStore.loadMessages(locale).catch(() => {})
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in new issue
Block a user