Browse Source

特殊面包屑和页面title支持中英文

cxmo 11 tháng trước cách đây
mục cha
commit
9ab89ad8ba
2 tập tin đã thay đổi với 13 bổ sung3 xóa
  1. 11 2
      src/main.js
  2. 2 1
      src/views/Home.vue

+ 11 - 2
src/main.js

@@ -208,10 +208,14 @@ router.beforeEach(async(to, from, next) => {
   /* 沙盘详情name添加 */
   if (to.path === "/sandflow") {
     to.matched[1].name = to.query.SandboxId? "编辑逻辑": "添加逻辑";
+    //支持英文
+    to.matched[1].meta.name_en = to.query.SandboxId? "Edit Logic": "Add Logic";
   }
 
   if (to.path === "/analyseVariety") {
     to.matched[1].name = to.query.type === "look" ? "查看品种" : "分析品种";
+    //支持英文
+    to.matched[1].meta.name_en = to.query.type === "look" ? "View Variety" : "Analyse Variety";
   }
 
   if (to.path) {
@@ -231,10 +235,15 @@ router.beforeEach(async(to, from, next) => {
 
 
 router.afterEach((to, from, next) => {
-  // 改变页面标题
+  /* // 改变页面标题
   document.title = to.matched[to.matched.length - 1].name
   ? `${to.matched[to.matched.length - 1].name}`
-  : setting.name;
+  : setting.name; */
+  //改变页面标题-中英文
+  const titleZh = to.matched[to.matched.length - 1].name||''
+  const titleEn = to.matched[to.matched.length - 1].meta.name_en||''
+  const title = i18n.locale==='zh'?titleZh:titleEn
+  document.title = title||setting.name
 
   window.scrollTo(0, 0);
   if(stores.state.hasTrialUserPermisson){

+ 2 - 1
src/views/Home.vue

@@ -158,7 +158,8 @@
                       @click.stop="routeClick(item)"
                     >
                       <template v-if="$route.path==='/positionAnalysisDetail'">
-                        {{breadSelfName||'持仓详情'}}
+                        <!-- {{breadSelfName||'持仓详情'}} -->
+                        {{$i18nt.locale==='zh'?'持仓详情':'Position Analysis'}}
                       </template>
                       <template v-else>
                         {{ $i18nt.locale==='zh'?item.name:item.meta.name_en }}