Ver código fonte

修改课程详情导航栏

11wqe1 1 ano atrás
pai
commit
24a9e7d698
1 arquivos alterados com 7 adições e 6 exclusões
  1. 7 6
      src/views/courseDetail/index.vue

+ 7 - 6
src/views/courseDetail/index.vue

@@ -97,23 +97,24 @@ export default {
     }
   },
   created() {
-
     console.log('type', this.$route.query)
     if (this.$route.query.urlType) {
       sessionStorage.setItem('urlType', this.$route.query.urlType)
+      return this.routeType = sessionStorage.getItem('urlType')
     }
 
     this.routeType = sessionStorage.getItem('urlType')
-    if (this.routeType == 1) {
-    // 跳转到登录界面之后,不让其回退。就直接添加下面这段代码即可实现
+  },
+
+  mounted() {
+    if (this.routeType * 1 == 1) {
+      console.log('清空记录');
+      // 跳转到登录界面之后,不让其回退。就直接添加1下面这段代码即可实现
       history.pushState(null, null, document.URL)
       window.addEventListener('popstate', function() {
         history.pushState(null, null, document.URL)
       })
     }
-  },
- 
-  mounted() {
     this.getCourse()
   }
 }