vue-router typescript generator for vue-class-component
npm install @foolishchow/vue-cli-plugin-ts-router-gen> generate vue router file by file structure
```
yarn add @foolishchow/vue-cli-plugin-ts-router-gen
typescript
/**
* @title [string] this is my page title
* @ignore [boolean] wether this is component is ignored
* @sort [number] sort value for slibing sort, default is 255
* @path [string] do not use filePath for router path , custom it by self
* @parent [string] you parent pageComponent name
* @meta [string] will be in this.$route.meta
* @show [boolean]
*/
@Component
export class MyPage extends Vue{}
`background gen process
- #### configs | name | description | required | type | default |
| ---- | :------------------------------- | :------: | :------: | :---------: |
| glob | glob config for vue router files | true | string[] |
undefined |
| root | router root file | true | string | undefined |
| file | genereated router file | true | string | undefined |- #### config for
@vue/cli demo
`js
// file $projectRoot/vue.config.js
// if pluginOptions.vuexGen is not configed , background gen process will not start
module.exports = {
pluginOptions: {
routerGen: {
glob: ["src/views/.+(ts|tsx)", "src/views//.+(ts|tsx)"],
root: "src/views",
file: "src/router.ts"
}
}
}
//or
module.exports = {
pluginOptions: {
routergen: {
glob: ["src/views/.+(ts|tsx)", "src/views//.+(ts|tsx)"],
root: "src/views",
file: "src/router.ts"
}
}
}
``