Index page scroll problem fixed
parent
fcfc7cc320
commit
384e9e93ac
|
@ -0,0 +1,9 @@
|
||||||
|
export default defineNuxtRouteMiddleware((to, from) => {
|
||||||
|
useNuxtApp().hook('page:finish', () => {
|
||||||
|
if (history.state.scroll) {
|
||||||
|
setTimeout(() => window.scrollTo(history.state.scroll), 0);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => window.scrollTo(0, 0), 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,29 @@
|
||||||
|
<template>
|
||||||
|
<div class="landing-intro">
|
||||||
|
<AppNews v-if="$appState.newsActive" />
|
||||||
|
<HeaderSection @theme-toggle="onThemeToggle" />
|
||||||
|
<HeroSection />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AppNews from '@/layouts/AppNews';
|
||||||
|
import HeaderSection from './landing/HeaderSection';
|
||||||
|
import HeroSection from './landing/HeroSection';
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
onThemeToggle() {
|
||||||
|
const newTheme = this.$appState.darkTheme ? 'lara-light-blue' : 'lara-dark-blue';
|
||||||
|
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
|
||||||
|
|
||||||
|
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
|
||||||
|
this.replaceTableTheme(newTableTheme);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
HeaderSection,
|
||||||
|
HeroSection,
|
||||||
|
AppNews
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -1,10 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="landingClass">
|
<div :class="landingClass">
|
||||||
<div class="landing-intro">
|
<Intro></Intro>
|
||||||
<AppNews v-if="$appState.newsActive" />
|
|
||||||
<HeaderSection @theme-toggle="onThemeToggle" />
|
|
||||||
<HeroSection />
|
|
||||||
</div>
|
|
||||||
<ComponentSection />
|
<ComponentSection />
|
||||||
<ThemeSection :theme="tableTheme" @table-theme-change="onTableThemeChange" />
|
<ThemeSection :theme="tableTheme" @table-theme-change="onTableThemeChange" />
|
||||||
<BlockSection />
|
<BlockSection />
|
||||||
|
@ -17,19 +13,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import EventBus from '@/layouts/AppEventBus';
|
import { defineAsyncComponent } from 'vue';
|
||||||
import AppNews from '@/layouts/AppNews';
|
|
||||||
import BlockSection from './landing/BlockSection';
|
import BlockSection from './landing/BlockSection';
|
||||||
import ComponentSection from './landing/ComponentSection';
|
import ComponentSection from './landing/ComponentSection';
|
||||||
import DesignerSection from './landing/DesignerSection';
|
import DesignerSection from './landing/DesignerSection';
|
||||||
import FeaturesSection from './landing/FeaturesSection';
|
import FeaturesSection from './landing/FeaturesSection';
|
||||||
import FooterSection from './landing/FooterSection';
|
import FooterSection from './landing/FooterSection';
|
||||||
import HeaderSection from './landing/HeaderSection';
|
|
||||||
import HeroSection from './landing/HeroSection';
|
|
||||||
import TemplateSection from './landing/TemplateSection';
|
import TemplateSection from './landing/TemplateSection';
|
||||||
import ThemeSection from './landing/ThemeSection';
|
import ThemeSection from './landing/ThemeSection';
|
||||||
import UsersSection from './landing/UsersSection';
|
import UsersSection from './landing/UsersSection';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
theme: {
|
theme: {
|
||||||
|
@ -57,13 +49,6 @@ export default {
|
||||||
this.replaceTableTheme(this.$appState.darkTheme ? 'lara-dark-blue' : 'lara-light-blue');
|
this.replaceTableTheme(this.$appState.darkTheme ? 'lara-dark-blue' : 'lara-light-blue');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onThemeToggle() {
|
|
||||||
const newTheme = this.$appState.darkTheme ? 'lara-light-blue' : 'lara-dark-blue';
|
|
||||||
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
|
|
||||||
|
|
||||||
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
|
|
||||||
this.replaceTableTheme(newTableTheme);
|
|
||||||
},
|
|
||||||
onTableThemeChange(value) {
|
onTableThemeChange(value) {
|
||||||
this.replaceTableTheme(value);
|
this.replaceTableTheme(value);
|
||||||
},
|
},
|
||||||
|
@ -96,8 +81,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
HeaderSection,
|
Intro: defineAsyncComponent(() => import('./Intro.vue')),
|
||||||
HeroSection,
|
|
||||||
ComponentSection,
|
ComponentSection,
|
||||||
ThemeSection,
|
ThemeSection,
|
||||||
BlockSection,
|
BlockSection,
|
||||||
|
@ -105,8 +89,7 @@ export default {
|
||||||
TemplateSection,
|
TemplateSection,
|
||||||
UsersSection,
|
UsersSection,
|
||||||
FeaturesSection,
|
FeaturesSection,
|
||||||
FooterSection,
|
FooterSection
|
||||||
AppNews
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
|
||||||
nuxtApp.$router.options.scrollBehavior = () => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve({ left: 0, top: 0, behaviour: 'smooth' });
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
Loading…
Reference in New Issue