bill 8 месяцев назад
Родитель
Сommit
92db3dd864
7 измененных файлов с 20 добавлено и 5 удалено
  1. 1 1
      index.html
  2. 2 0
      src/lang/index.ts
  3. 1 1
      src/main.ts
  4. 4 2
      src/router/constant.ts
  5. 3 0
      src/sdk/association.ts
  6. 8 0
      src/setup.ts
  7. 1 1
      src/views/tagging/edit.vue

+ 1 - 1
index.html

@@ -8,6 +8,6 @@
   </head>
   <body>
     <div id="app"></div>
-    <script type="module" src="/src/main.ts"></script>
+    <script type="module" src="/src/setup.ts"></script>
   </body>
 </html>

+ 2 - 0
src/lang/index.ts

@@ -20,6 +20,7 @@ Promise.all([zhPromise, enPromise, jpPromise]).then(() => (loaded.value = true))
 const localKey = 'lang'
 const local = {
   get: localGetFactory(str => {
+    return langNameEum.zh
     if (str) {
       return str as langNameEum
     } else {
@@ -57,6 +58,7 @@ export const langs = {
   [langNameEum.jp]: jp
 }
 
+i18n.global.locale.value = lang
 i18n.global.setLocaleMessage(langNameEum.zh, zh)
 i18n.global.setLocaleMessage(langNameEum.en, en)
 i18n.global.setLocaleMessage(langNameEum.jp, jp)

+ 1 - 1
src/main.ts

@@ -2,8 +2,8 @@ import { createApp } from 'vue'
 import './style.scss'
 import App from './app.vue'
 import Components from 'bill/index'
-import router from './router'
 import { setupI18n, ui18n } from '@/lang'
+import router from './router'
 
 const app = createApp(App)
 app.use(Components)

+ 4 - 2
src/router/constant.ts

@@ -1,4 +1,5 @@
 import { ui18n } from "@/lang"
+import { reactive } from "vue"
 
 export enum RoutesName {
   merge = 'merge',
@@ -16,7 +17,7 @@ export const paths: RouteSeting<string> = {
 
 export type Meta = { title: string, icon: string }
 
-export const metas: RouteSeting<Meta> = {
+export const metas: RouteSeting<Meta> = reactive({
   [RoutesName.merge]: {
     icon: 'joint',
     title: ui18n.t('sys.merge.joint')
@@ -29,6 +30,7 @@ export const metas: RouteSeting<Meta> = {
     icon: 'path',
     title: ui18n.t('sys.guide.path')
   }
-}
+})
 
+console.log(ui18n.t('sys.merge.joint'))
 export const ViewHome = RoutesName.merge

+ 3 - 0
src/sdk/association.ts

@@ -28,6 +28,7 @@ import Components from "bill/index";
 import { Model } from "@/store";
 
 import type { SDK, SceneModel, SceneGuidePath, ModelAttrRange } from ".";
+import { setupI18n } from "@/lang";
 
 export const modelRange: ModelAttrRange = {
   opacityRange: { min: 0, max: 100, step: 0.1 },
@@ -261,4 +262,6 @@ export const setupAssociation = (mountEl: HTMLDivElement) => {
   const sdkApp = createApp(SDKApp);
   sdkApp.mount(mountEl);
   sdkApp.use(Components);
+  setupI18n(sdkApp)
+  
 };

+ 8 - 0
src/setup.ts

@@ -0,0 +1,8 @@
+import { loaded } from '@/lang'
+import { watchEffect } from 'vue'
+
+watchEffect(() => {
+  if (loaded.value) {
+    import('./main')
+  }
+})

+ 1 - 1
src/views/tagging/edit.vue

@@ -38,7 +38,7 @@
         v-model="tagging.part"
       >
         <template #preIcon
-          ><span>{{ $t("sys.tagging.hot.plc") }}</span></template
+          ><span>{{ $t("sys.tagging.hot.part") }}</span></template
         >
       </ui-input>
       <ui-input