From 68cbb649c933776838e937446ce9ed384916a5e8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 14 八月 2019 14:20:59 +0800
Subject: [PATCH] 2019-08-14update

---
 src/views/companyProfile/index.vue |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/src/views/companyProfile/index.vue b/src/views/companyProfile/index.vue
index 796f59f..51d040d 100644
--- a/src/views/companyProfile/index.vue
+++ b/src/views/companyProfile/index.vue
@@ -256,15 +256,18 @@
 export default {
 	data() {
 		return {
-      img_index:0,
-      anchor:false,
+      img_index: 0,
+      anchor: false
 		}
 	},
-	mounted () {
-    let url = location.href
-    let hash = url.substring(url.length-9)
-    this.get_anchor(hash)
-	},
+  watch: { //鐩戝惉璺敱
+    $route (to, from) {
+      if (to.params.hash && to.params.hash !== 'null') {
+        this.anchor = true
+        this.get_anchor(to.params.hash)
+      }
+    }
+  },
 	methods: {
     //鏍规嵁hash鍊艰烦杞笉鍚岄敋鐐�
 		get_anchor (hash) {
@@ -273,18 +276,13 @@
       }
     }
   },
-  destroyed () { //杩斿洖椤堕儴
-    document.body.scrollTop = 0
-    document.documentElement.scrollTop = 0
-  },
-  watch: { //鐩戝惉璺敱
-    $route (to,from) {
-      if (to.hash) {
-        this.anchor = true
-        this.get_anchor(to.hash)
-      }
+	mounted () {
+    let hash = this.$route.params.hash
+    if (hash && hash !== 'null') {
+      this.anchor = true
+      this.get_anchor(hash)
     }
-  }
+	}
 }
 </script>
 

--
Gitblit v1.8.0