Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 4, 2022
1 parent dc7a3ca commit 85ef2f7
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions docs/content/2.guide/3.directory-structure/10.pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ If returning `null` or `undefined`, Nuxt will fallback to the default history.

```js [app/router.options.ts]
import type { RouterOptions } from '@nuxt/schema'
import { createWebHashHistory } from 'vue-router'
import { createMemoryHistory } from 'vue-router'

// https://router.vuejs.org/api/interfaces/routeroptions.html
export default <RouterOptions> {
history: (base) => process.client ? createWebHashHistory(base) : null /* use default */
history: base => process.client ? createMemoryHistory(base) : null /* default */
}
```

Expand All @@ -389,6 +389,7 @@ export default <RouterOptions> {
- `end`
- `sensitive`
- `strict`
- `hashMode`

```js [nuxt.config]
export default defineNuxtConfig({
Expand All @@ -399,6 +400,25 @@ export default defineNuxtConfig({
})
```

### Hash Mode (SPA)

:StabilityEdge{title="hash mode"}

You can enable hash history in SPA mode. In this mode, router uses a hash character (#) before the actual URL that is internally passed. When enabled, the **URL is never sent to the server** and **SSR is not supported**.

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
ssr: false,
router: {
options: {
hashMode: true
}
}
})
```

## Programmatic Navigation

Nuxt 3 allows programmatic navigation through the `navigateTo()` utility method. Using this utility method, you will be able to programmatically navigate the user in your app. This is great for taking input from the user and navigating them dynamically throughout your application. In this example, we have a simple method called `navigate()` that gets called when the user submits a search form.
Expand Down

0 comments on commit 85ef2f7

Please sign in to comment.