@foolishchow/vue-cli-plugin-ts-router-gen
v0.1.4
Published
vue-router typescript generator for vue-class-component
Downloads
277
Maintainers
Readme
vue-cli-plugin-ts-router-gen
generate vue router file by file structure
yarn add @foolishchow/vue-cli-plugin-ts-router-gen
example
comment option you can use
/**
* @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
// 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"
}
}
}