Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump vue-auto-routing v0.5.0 #31

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ export default [

If you want to make route param required, create a directory for the param and add `index.vue` in the directory. In the above example, if you replace `users/_id.vue` with `users/_id/index.vue`, `:id` param will be required.

#### `<route-meta>` custom block
#### `<route>` custom block

If a page component has `<route-meta>` custom block, the content json will be used as [route meta field](https://router.vuejs.org/guide/advanced/meta.html).
If a page component has `<route>` custom block, the content json will be merged with [route config](https://router.vuejs.org/api/#routes).

For example, if `index.vue` has the following `<route-meta>` block:
For example, if `index.vue` has the following `<route>` block:

```vue
<route-meta>
<route>
{
"requiresAuth": true
"name": "home",
"meta": {
"requiresAuth": true
}
}
</route-meta>
</route>

<template>
<h1>Hello</h1>
Expand All @@ -91,7 +94,7 @@ The generated route config is like the following:
```js
module.exports = [
{
name: 'index',
name: 'home',
path: '/',
component: () => import('@/pages/index.vue'),
meta: {
Expand Down
2 changes: 1 addition & 1 deletion generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = (api) => {
'vue-router-layout': '^0.1.2',
},
devDependencies: {
'vue-auto-routing': '^0.4.0',
'vue-auto-routing': '^0.5.0',
},
vue: {
pluginOptions: {
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ module.exports = (api, options) => {
.post()
.resourceQuery(/blockType=route-meta/)
.use('route-meta')
.loader('vue-cli-plugin-auto-routing/route-meta-loader')
.loader('vue-cli-plugin-auto-routing/route-loader')

// prettier-ignore
webpackConfig.module
.rule('route')
.post()
.resourceQuery(/blockType=route/)
.use('route')
.loader('vue-cli-plugin-auto-routing/route-loader')
})
}
File renamed without changes.