From 570f5e278c2adf21a0d4eb7514a1a7b745f50a02 Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Mon, 25 Aug 2025 10:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cool/index.ts | 13 ++++++++- pages.json | 20 ++++++------- pages/demo/form/select.uvue | 2 +- .../cool-ui/components/cl-page/cl-page.uvue | 28 ++----------------- 4 files changed, 25 insertions(+), 38 deletions(-) diff --git a/cool/index.ts b/cool/index.ts index 0a3bb01..678630f 100644 --- a/cool/index.ts +++ b/cool/index.ts @@ -1,6 +1,8 @@ +import { watch } from "vue"; import { scroller } from "./scroller"; import { initTheme, setH5 } from "./theme"; -import { initLocale } from "@/locale"; +import { initLocale, locale, updateTitle } from "@/locale"; +import "@/uni_modules/cool-ui"; export function cool(app: VueApp) { app.mixin({ @@ -8,11 +10,20 @@ export function cool(app: VueApp) { scroller.emit(e.scrollTop); }, onShow() { + // 更新标题 + updateTitle(); + // #ifdef H5 setTimeout(() => { setH5(); }, 0); // #endif + }, + onLoad() { + // 监听语言切换,更新标题 + watch(locale, () => { + updateTitle(); + }); } }); diff --git a/pages.json b/pages.json index af8f6e6..e668d03 100644 --- a/pages.json +++ b/pages.json @@ -15,7 +15,7 @@ { "path": "pages/index/template", "style": { - "navigationBarTitleText": "%模板%" + "navigationBarTitleText": "模板" } } ], @@ -26,19 +26,19 @@ { "path": "index", "style": { - "navigationBarTitleText": "%设置%" + "navigationBarTitleText": "设置" } }, { "path": "general", "style": { - "navigationBarTitleText": "%通用设置%" + "navigationBarTitleText": "通用设置" } }, { "path": "notice", "style": { - "navigationBarTitleText": "%通知设置%" + "navigationBarTitleText": "通知设置" } }, { @@ -50,7 +50,7 @@ { "path": "cs", "style": { - "navigationBarTitleText": "%联系客服%" + "navigationBarTitleText": "联系客服" } } ] @@ -61,7 +61,7 @@ { "path": "edit", "style": { - "navigationBarTitleText": "%编辑资料%" + "navigationBarTitleText": "编辑资料" } }, { @@ -432,7 +432,7 @@ { "path": "shop/goods-category", "style": { - "navigationBarTitleText": "%商品分类%" + "navigationBarTitleText": "商品分类" } }, { @@ -463,19 +463,19 @@ "pagePath": "pages/index/home", "iconPath": "/static/icon/tabbar/home.png", "selectedIconPath": "/static/icon/tabbar/home2.png", - "text": "%首页%" + "text": "首页" }, { "pagePath": "pages/index/template", "iconPath": "/static/icon/tabbar/template.png", "selectedIconPath": "/static/icon/tabbar/template2.png", - "text": "%模板%" + "text": "模板" }, { "pagePath": "pages/index/my", "iconPath": "/static/icon/tabbar/my.png", "selectedIconPath": "/static/icon/tabbar/my2.png", - "text": "%我的%" + "text": "我的" } ] }, diff --git a/pages/demo/form/select.uvue b/pages/demo/form/select.uvue index 0fd995f..8d23bf8 100644 --- a/pages/demo/form/select.uvue +++ b/pages/demo/form/select.uvue @@ -31,7 +31,7 @@ - 打开 + {{ t("打开") }} diff --git a/uni_modules/cool-ui/components/cl-page/cl-page.uvue b/uni_modules/cool-ui/components/cl-page/cl-page.uvue index b91733f..4440cdb 100644 --- a/uni_modules/cool-ui/components/cl-page/cl-page.uvue +++ b/uni_modules/cool-ui/components/cl-page/cl-page.uvue @@ -22,12 +22,11 @@