From 48c84abfa45b51dac5e4c736fcdaa15a4e9921ac Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 12 May 2022 11:14:24 +0200 Subject: [PATCH] Apply suggestions from code review --- docs/guide/essentials/history-mode.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/guide/essentials/history-mode.md b/docs/guide/essentials/history-mode.md index d3205193..bbed3c8b 100644 --- a/docs/guide/essentials/history-mode.md +++ b/docs/guide/essentials/history-mode.md @@ -45,12 +45,13 @@ Here comes a problem, though: Since our app is a single page client side app, wi Not to worry: To fix the issue, all you need to do is add a simple catch-all fallback route to your server. If the URL doesn't match any static assets, it should serve the same `index.html` page that your app lives in. Beautiful, again! -## Abstract mode +## Memory mode -The abstract history mode is created with `createMemoryHistory()`: +The memory history mode doesn't assume a browser environment and therefore doesn't interact with the URL **nor automatically triggers the initial navigation**. This makes it perfect for Node environment and SSR. It is created with `createMemoryHistory()` and **requires you to push the initial navigation** after calling `app.use(router)`. ```js import { createRouter, createMemoryHistory } from 'vue-router' + const router = createRouter({ history: createMemoryHistory(), routes: [ @@ -59,7 +60,7 @@ const router = createRouter({ }) ``` -When using `createMemoryHistory()` the URL will not change when navigating between routes and no entries will be created in the browser history. The history is kept "hidden" within the javascript. The history will not persist when leaving or reloading the app, you get a fresh start every time your app is reloaded. Vue Router will always try to resolve the root `'/'` path when the app is loaded. +While it's not recommended, you can use this mode inside Browser applications but note **there will be no history**, meaning you won't be able to go _back_ or _forward_. ## Example Server Configurations -- 2.39.5