From e2438ba03eddd22696811206de32ea9a79d90001 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih Date: Wed, 27 Dec 2023 22:22:47 +0900 Subject: [PATCH] =?UTF-8?q?(fix)=20=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E3=81=AB=E7=A7=BB=E5=8B=95=E3=81=97=E3=81=9F=E9=9A=9B=E3=81=AE?= =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97=E3=81=84=20fix=20#89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.vue | 5 ----- app/router.options.ts | 34 ++++++++++++++++++++++++++++++++++ tailwind.config.ts | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 app/router.options.ts diff --git a/app.vue b/app.vue index 472fd525..08a0f557 100644 --- a/app.vue +++ b/app.vue @@ -20,11 +20,6 @@ router.beforeEach((to, from) => { } }) -nuxtApp.hook('page:loading:start', () => { - if (!NProgress.isStarted()) { - NProgress.start(); - } -}); nuxtApp.hook('page:loading:end', () => { nextTick(() => { setTimeout(() => { diff --git a/app/router.options.ts b/app/router.options.ts new file mode 100644 index 00000000..52c2b207 --- /dev/null +++ b/app/router.options.ts @@ -0,0 +1,34 @@ +import type { RouterConfig } from '@nuxt/schema' + +export default { + scrollBehavior(to, from, savedPosition) { + const width = window ? window.innerWidth : 0; + + if (savedPosition) { + return savedPosition; + } else if (to.meta.layout && to.hash) { + switch (to.meta.layout) { + case 'blank': + return { el: to.hash }; + + case 'docs': + if (width < 1024) { + return { top: 128, el: to.hash }; + } else { + return { top: 80, el: to.hash }; + } + + case 'slim': + case 'tools': + return { top: 80, el: to.hash }; + + default: + if (width < 1024) { + return { top: 80, el: to.hash }; + } else { + return { top: 96, el: to.hash }; + } + } + } + }, +} diff --git a/tailwind.config.ts b/tailwind.config.ts index f6a5c4bd..0b953bce 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -14,6 +14,7 @@ export default { ], safelist: [ 'scroll-pt-20', + 'scroll-pt-24', 'scroll-pt-32', 'lg:scroll-pt-4', 'lg:scroll-pt-20',