We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 20a0f5a + d557a6e commit ab7080aCopy full SHA for ab7080a
2 files changed
src/router/index.js
@@ -3,6 +3,7 @@ import VueRouter from 'vue-router'
3
import Home from '../views/Home.vue'
4
import SearchReps from '../components/SearchReps'
5
import RepresentativeCard from '../components/RepresentativeCard'
6
+import scrollBehavior from './scroll-behavior'
7
// import Reps from '../components/Reps'
8
9
Vue.use(VueRouter)
@@ -48,6 +49,7 @@ const routes = [
48
49
50
const router = new VueRouter({
51
mode: 'history',
52
+ scrollBehavior,
53
base: process.env.BASE_URL,
54
routes
55
})
src/router/scroll-behavior.js
@@ -0,0 +1,9 @@
1
+const scrollBehavior = (to, from, savedPosition) => {
2
+ if (savedPosition) {
+ return savedPosition
+ } else {
+ return { x: 0, y: 0 }
+ }
+}
+
+export default scrollBehavior
0 commit comments