From a6de96f5fb5da20add2b0063bb67bd194a04ceba Mon Sep 17 00:00:00 2001 From: Bahadir Sofuoglu Date: Mon, 12 Sep 2022 13:35:24 +0300 Subject: [PATCH] Scrolltotop added to plugin --- components/editor/Editor.vue | 2 +- components/fullcalendar/FullCalendar.d.ts | 2 +- components/fullcalendar/FullCalendar.vue | 11 +++++------ nuxt.config.js | 2 +- pages/datatable/{TableScroll.vue => Scroll.vue} | 0 pages/landing/HeroSection.vue | 2 +- plugins/primeVue.js | 2 +- plugins/scrollToTop.js | 9 +++++++++ vitest.config.js | 9 +++++++++ 9 files changed, 28 insertions(+), 11 deletions(-) rename pages/datatable/{TableScroll.vue => Scroll.vue} (100%) create mode 100644 plugins/scrollToTop.js create mode 100644 vitest.config.js diff --git a/components/editor/Editor.vue b/components/editor/Editor.vue index 9137581c6..477817252 100755 --- a/components/editor/Editor.vue +++ b/components/editor/Editor.vue @@ -48,7 +48,7 @@ - + diff --git a/nuxt.config.js b/nuxt.config.js index 3ad1d20af..0f561ce13 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -20,7 +20,7 @@ export default defineNuxtConfig({ rel: 'stylesheet', href: './styles/landing/themes/lara-light-blue/theme.css' } - ] + ], }, }, css: [ diff --git a/pages/datatable/TableScroll.vue b/pages/datatable/Scroll.vue similarity index 100% rename from pages/datatable/TableScroll.vue rename to pages/datatable/Scroll.vue diff --git a/pages/landing/HeroSection.vue b/pages/landing/HeroSection.vue index 444e96e53..0a29b22c1 100644 --- a/pages/landing/HeroSection.vue +++ b/pages/landing/HeroSection.vue @@ -106,7 +106,7 @@ export default { } }, mounted() { - this.setAnimation = true + this.setAnimation = true }, methods: { navigateTo(url) { diff --git a/plugins/primeVue.js b/plugins/primeVue.js index bb055fe06..efac3c65c 100644 --- a/plugins/primeVue.js +++ b/plugins/primeVue.js @@ -152,7 +152,7 @@ nuxtApp.vueApp.component('Dropdown', Dropdown); /* nuxtApp.vueApp.component('Editor', Editor); */ nuxtApp.vueApp.component('Fieldset', Fieldset); nuxtApp.vueApp.component('FileUpload', FileUpload); -nuxtApp.vueApp.component('FullCalendar', FullCalendar); +//nuxtApp.vueApp.component('FullCalendar', FullCalendar); nuxtApp.vueApp.component('Image', Image); nuxtApp.vueApp.component('InlineMessage', InlineMessage); nuxtApp.vueApp.component('Inplace', Inplace); diff --git a/plugins/scrollToTop.js b/plugins/scrollToTop.js new file mode 100644 index 000000000..877059fc0 --- /dev/null +++ b/plugins/scrollToTop.js @@ -0,0 +1,9 @@ +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.$router.options.scrollBehavior = (to, from, savedPosition) => { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve({ left: 0, top: 0, behaviour: "smooth" }); + }, 100); + }); + }; +}); \ No newline at end of file diff --git a/vitest.config.js b/vitest.config.js new file mode 100644 index 000000000..1dc0c06b7 --- /dev/null +++ b/vitest.config.js @@ -0,0 +1,9 @@ +import vue from '@vitejs/plugin-vue'; + +export default { + plugins: [vue()], + test: { + globals: true, + environment: 'jsdom', + }, +} \ No newline at end of file