From 96973dca40a1815e9727160e6b2e6dee839b9f8d Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 31 十二月 2025 13:06:14 +0800
Subject: [PATCH] 质量模具模块页面优化

---
 main.js |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/main.js b/main.js
index 983fc86..6bd543f 100644
--- a/main.js
+++ b/main.js
@@ -1,3 +1,27 @@
+// 瀵煎叆i18n鏂囦欢
+import en from "./locale/en.json"
+import ZhCN from "./locale/zh-Hans.json"
+
+// 鍔犺浇鏈湴璇█鍖�
+const messages = {
+	"zh-Hans":ZhCN,
+	en,
+}
+
+let i18nConfig = {
+  locale: uni.getLocale(),// 鑾峰彇宸茶缃殑璇█
+  messages,
+  silentTranslationWarn: true,
+  missing: function(locale, key, vm, values){
+    // 椤甸潰涓惈鏈夎瑷�鍖呬腑涓嶅瓨鍦ㄧ殑瀛楁锛岄渶鍚屾鍒版暟鎹簱涓�
+      console.log("[i18n]: 椤甸潰涓璳ey涓�: ", key ,"鐨勫瓧娈靛湪缈昏瘧鏂囦欢涓笉瀛樺湪锛屽悓姝ュ埌鏁版嵁搴�...")
+  
+    // 涓洪檷浣庡悓姝ョ殑闅惧害锛孉PP涓� 瀵圭炕璇戞ā鍧楃殑key 涓嶉噰鐢ㄦ暟缁勭殑鍐欐硶锛岀粺涓�浣跨敤 妯″潡鍚�.瀛楁鍚嶇殑鍐欐硶
+  }
+}
+
+
+
 import App from './App'
 import Printer from './plugins/printer'
 Vue.use(Printer);
@@ -16,20 +40,40 @@
 
 // #ifndef VUE3
 import Vue from 'vue'
+import VueI18n from 'vue-i18n'
+
+Vue.use(VueI18n)
+const i18n = new VueI18n(i18nConfig)
 Vue.config.productionTip = false
 App.mpType = 'app'
 const app = new Vue({
+    i18n,
     ...App
 })
 app.$mount()
+export default i18n
 // #endif
 
 // #ifdef VUE3
 import { createSSRApp } from 'vue'
+import { createI18n } from 'vue-i18n'// v9.x
+const i18n = createI18n(i18nConfig)
 export function createApp() {
   const app = createSSRApp(App)
+  app.use(i18n)
   return {
     app
   }
 }
-// #endif
\ No newline at end of file
+export default i18n
+// #endif
+// main.js uni.showToast 瀹炵幇鍏ㄥ眬鎷︽埅璁剧疆榛樿鎻愮ず鏃堕棿涓�3.5绉�
+const originalShowToast = uni.showToast;
+uni.showToast = (options) => {
+  originalShowToast({
+    duration: options.duration || 3500, // 榛樿2绉�
+    icon: options.icon || 'none',
+	title: options.title || 'none',
+    ...options
+  });
+};
\ No newline at end of file

--
Gitblit v1.9.1