Zaklad ssr
This commit is contained in:
+2
-11
@@ -3,16 +3,7 @@ import {createRouter, createMemoryHistory, createWebHistory, createWebHashHistor
|
||||
import routes from './routes'
|
||||
import {useAppStore} from "stores/App";
|
||||
|
||||
/*
|
||||
* If not building with SSR mode, you can
|
||||
* directly export the Router instantiation;
|
||||
*
|
||||
* The function below can be async too; either use
|
||||
* async/await or return a Promise which resolves
|
||||
* with the Router instance.
|
||||
*/
|
||||
|
||||
export default route(function (/* { store, ssrContext } */) {
|
||||
export default route(function ({ store }) {
|
||||
const createHistory = process.env.SERVER
|
||||
? createMemoryHistory
|
||||
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory)
|
||||
@@ -29,7 +20,7 @@ export default route(function (/* { store, ssrContext } */) {
|
||||
|
||||
Router.afterEach(async (to, from) => {
|
||||
if (from.name !== to.name) {
|
||||
useAppStore().resetAfterRouteChange();
|
||||
useAppStore(store).resetAfterRouteChange();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user