nuxt-router-extras can:
- define custom paths for page
- specify multiple paths to single page
- define multiple params regardless of pages directory structure
- Add
nuxt-router-extrasdependency using yarn or npm to your project - Add
nuxt-router-extrastomodulessection ofnuxt.config.js
{
modules: [
// Simple usage
'nuxt-router-extras',
// With options
['nuxt-router-extras', { /* module options */ }],
]
}-
define custom paths for page
Simply add a block inside vue file and define path in Yaml
<router> path: /posts </router> -
specify multiple paths to single page
If you want more paths for a single page, define them with aliases
<router> path: /posts alias: - /articles - /blog </router> -
define multiple params regardless of pages directory structure
<router> path: /post/:id/:title? </router>
path: Change page urlalias: Add single or multiple aliases to pagemeta: Add Meta information to page, metas can be used by middlewaresprops: Pass predefined props to page
Install Vetur extension and define custom block
- Add
<router>tovetur.grammar.customBlocksin VSCode settings"vetur.grammar.customBlocks": { "docs": "md", "i18n": "json", "router": "yaml" } - Execute command
> Vetur: Generate grammar from vetur.grammar.customBlocksin VSCode - Restart VSCode and enjoy awesome
- Clone this repository
- Install dependencies using
yarn installornpm install - Start development server using
npm run dev
Copyright (c)