Skip to content

演示如何使用 require.context 实现自动注册vue-router路由

License

Notifications You must be signed in to change notification settings

libin1991/demo-require-context

 
 

Repository files navigation

demo-require-context

本项目演示 require.context 如何帮助开发者更方便地开发 vue 项目

示例的自动注册路由方法在实际项目中可能并没有太大的实用性,依项目复杂度而定

另一个关于 require.context 的示例 d2admin 的自动注册 svg 图标到图标组件功能

demo 只作为抛砖引玉,欢迎大家补充

注意:本 demo 仅在 posix 型系统下有效,比如 macOS,Windows 用户需要修改代码

preview

index

user

pages

error

mixin

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

About

演示如何使用 require.context 实现自动注册vue-router路由

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.4%
  • Vue 28.4%
  • HTML 1.2%