From 80476fae71f08bf4408c7509eff254031a4eeac6 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Wed, 24 Aug 2022 18:47:09 +0800
Subject: [PATCH] 路由修正,常量提取

---
 src/router/router.js |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/router/router.js b/src/router/router.js
index 1522bca..de20598 100644
--- a/src/router/router.js
+++ b/src/router/router.js
@@ -12,7 +12,16 @@
 /*实例化路由*/
 const router = new Router({
 	mode: "history", //模式修改  
-	routes: asyncRouterMap
+	routes: asyncRouterMap,
+	scrollBehavior (to, from, savedPosition) {
+		
+		//路由切换是否滚动到顶部
+	   if (savedPosition) {
+	     return savedPosition
+	    } else {
+	     return { x: 0, y: 0 }
+	    }
+	}
 })
 
 router.beforeEach((to, from, next) => {

--
Gitblit v1.9.1