diff options
| author | 2023-04-19 17:50:02 +0800 | |
|---|---|---|
| committer | 2023-04-19 17:50:02 +0800 | |
| commit | 56a6240bf700ac307342ed494d8bfbabe5c822dc (patch) | |
| tree | 0b1288a2ec1cbb538c11f4c122b6a97b9c55a05f /docs/app/router.options.ts | |
| parent | 3adc965dd09490b7efa1cce9f09b0a3b30970277 (diff) | |
| download | HydroRoll-56a6240bf700ac307342ed494d8bfbabe5c822dc.tar.gz HydroRoll-56a6240bf700ac307342ed494d8bfbabe5c822dc.zip | |
✨docs init
Diffstat (limited to 'docs/app/router.options.ts')
| -rw-r--r-- | docs/app/router.options.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/docs/app/router.options.ts b/docs/app/router.options.ts deleted file mode 100644 index 9380f05..0000000 --- a/docs/app/router.options.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { RouterConfig } from '@nuxt/schema' -// https://router.vuejs.org/api/interfaces/routeroptions.html -export default <RouterConfig> { - scrollBehavior (to, _form, savedPosition) { - if (history.state.stop) { return } - - if (history.state.smooth) { - return { - el: history.state.smooth, - behavior: 'smooth' - } - } - - if (to.hash) { - const el = document.querySelector(to.hash) as any - - if (!el) { return } - - const { marginTop } = getComputedStyle(el) - - const marginTopValue = parseInt(marginTop) - - const offset = (document.querySelector(to.hash) as any).offsetTop - marginTopValue - - return { - top: offset, - behavior: 'smooth' - } - } - - // Scroll to top of window - if (savedPosition) { - return savedPosition - } else { - return { top: 0 } - } - } -} |
