npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-gen-router

v0.0.6

Published

Automated generation of vue-router

Downloads

6

Readme

NPM NPM Apache 2.0 License

自动生成router文件

通常情况下一个vue项目,随着时间的增加,router会越来越多,而大部分的代码其实都是重复的,修改很麻烦,还不如通过工具生成。

快速开始

为package.json添加依赖

yarn add --dev vue-gen-router

4种使用方式

  1. 把yaml数据转换成tsx,并且输出到src/routers目录下,文件命名为config.tsx
node_modules/.bin/vue-gen-router -i example/router.yaml  -o src/routers -f config.tsx
  1. 把yaml数据转换成js,并且输出到src/routers目录下,文件命名为config.js
node_modules/.bin/vue-gen-router -i example/router.yaml  -o src/routers -f config.js
  1. 把tsx数据转换成yaml文件,并且输出到./目录下,文件命名为router.yaml
node_modules/.bin/vue-gen-router -i example/config.tsx  -o src/routers -f router.yaml

参考例子中文件夹下的example/router.yaml,建立自己的router.yaml,基本上和之前写vue-router时没有多大区别

yaml 配置选项参考vue-router

参考example

具体参照官网 https://router.vuejs.org/zh/api/#routes

cli 配置选项

  • [x] [必选]-i yaml的加载文件
  • [ ] [可选]-f 生成的router的文件名,默认是config.tsx, 如果修改成xxx.js,则生成的就是js文件
  • [ ] [可选]-o 生成的router的文件输出到那个文件夹,默认是src/routers