Skip to content

Commit

Permalink
✨ make URL parameters persist
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZhang73 committed Feb 27, 2022
1 parent 4bc8fc0 commit b0a6182
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ dist-ssr
src/public/annotation
src/public/config
src/public/video
src/public/dataset
9 changes: 8 additions & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRouter, createWebHistory } from 'vue-router'

export default createRouter({
const router = createRouter({
history: createWebHistory(),
routes: [
{
Expand Down Expand Up @@ -35,3 +35,10 @@ export default createRouter({
}
]
})

router.beforeEach((to, from) => {
if (to.path === from.path || Object.keys(to.query).length) return true
return { ...to, query: from.query }
})

export default router

0 comments on commit b0a6182

Please sign in to comment.