Administrator преди 1 година
родител
ревизия
e018b1b955
променени са 1 файла, в които са добавени 11 реда и са изтрити 3 реда
  1. 11 3
      file/resources/js/handler.js

+ 11 - 3
file/resources/js/handler.js

@@ -21,7 +21,14 @@ function JumpRouter(url, name) {
     if (path.indexOf(window.location.host) !== -1) {
         path = path.substring(path.indexOf(window.location.host) + window.location.host.length)
     }
-    let title = name ? name : document.title;
+    let titles = document.getElementsByClassName("goods-show-title")
+    let text = ""
+    if (titles.length === 0) {
+        text = document.title
+    } else {
+        text = document.getElementsByClassName("goods-show-title")[0].textContent
+    }
+    let title = name ? name : text;
     if (path === '' || path === "/") {
         sessionStorage.setItem(RouterLinkName, JSON.stringify([]))
     }
@@ -80,7 +87,7 @@ function RouterBarCreate() {
 
     if (routerLink) {
         for (let i = 0; i < routerLink.length; i++) {
-            if (routerLink[i].url==="/"){
+            if (routerLink[i].url === "/") {
                 continue
             }
             let liEle = document.createElement("li");
@@ -98,7 +105,8 @@ function RouterBarCreate() {
     }
 
     let nowEle = document.createElement("li")
-    nowEle.innerText = document.title
+    let text = document.getElementsByClassName("goods-show-title")[0].textContent
+    nowEle.innerText = text.trim()
     nowEle.className = "router-bar-text"
     ulEle.appendChild(nowEle)
 }