Skip to content

Commit ab7080a

Browse files
Merge pull request #480 from ProgramEquity/SMGBranch
2 parents 20a0f5a + d557a6e commit ab7080a

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/router/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import VueRouter from 'vue-router'
33
import Home from '../views/Home.vue'
44
import SearchReps from '../components/SearchReps'
55
import RepresentativeCard from '../components/RepresentativeCard'
6+
import scrollBehavior from './scroll-behavior'
67
// import Reps from '../components/Reps'
78

89
Vue.use(VueRouter)
@@ -48,6 +49,7 @@ const routes = [
4849

4950
const router = new VueRouter({
5051
mode: 'history',
52+
scrollBehavior,
5153
base: process.env.BASE_URL,
5254
routes
5355
})

src/router/scroll-behavior.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const scrollBehavior = (to, from, savedPosition) => {
2+
if (savedPosition) {
3+
return savedPosition
4+
} else {
5+
return { x: 0, y: 0 }
6+
}
7+
}
8+
9+
export default scrollBehavior

0 commit comments

Comments
 (0)