feat(i18n): 优化国际化路由标题设置逻辑并修复响应式问题
Some checks failed
CI/CD Pipeline / playwright (push) Successful in 4m3s
CI/CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
严浩
2025-11-04 11:09:39 +08:00
parent 6e915a5977
commit c0c5e9763e
3 changed files with 17 additions and 11 deletions

View File

@@ -21,12 +21,17 @@ function setLocale(newLocale: 'en-US' | 'zh-CN') {
{{ t('page.i18n-demo.hello', { name: 'Kilo' }) }}
</n-p>
<n-p> $route.meta: {{ $route.meta }} </n-p>
<n-space>
<n-button type="primary" @click="setLocale('en-US')"> English </n-button>
<n-button type="success" @click="setLocale('zh-CN')"> 简体中文 </n-button>
</n-space>
</n-card>
<!-- 这里响应式有问题: -->
<n-p> $route.meta.title: {{ $route.meta.title }} </n-p>
<!-- 这样才正常 -->
<n-p>
routeI18nInstance.global.t($route.name): {{ routeI18nInstance.global.t($route.name) }}
</n-p>
</div>
</template>