@mpilk/mp-route
v4.0.1
Published
Generate uni-app pages.json route, subpackage, preload, condition, and tabBar configuration from route files.
Maintainers
Readme
@mpilk/mp-route
用于根据 route 和 tabbar 配置文件生成 uni-app 的 pages.json 路由配置。
安装
npm install -D @mpilk/mp-route@mpilk/mp-route 依赖 @mpilk/mp-shared,安装时会自动安装共享工具包。
CLI 用法
mp-route --help
mp-route build
mp-route watch也可以使用别名命令:
uni-route --help
urc --helpRoute 配置
import { defineMiniRouter } from '@mpilk/mp-route'
export default defineMiniRouter({
title: '首页',
path: 'pages/home/index',
isIndex: true
})TabBar 配置
import { defineMiniTabbar } from '@mpilk/mp-route'
export default defineMiniTabbar({
color: '#666666',
selectedColor: '#007aff',
backgroundColor: '#ffffff',
list: [
{
pagePath: 'pages/home/index',
text: '首页'
}
]
})库 API
import {
builder,
builderWithWatch,
defineMiniRouter,
defineMiniTabbar
} from '@mpilk/mp-route'包格式
当前包同时提供 ESM 和 CommonJS 产物:
- ESM:
dist/index.js - CommonJS:
dist/index.cjs - 类型声明:
dist/index.d.ts - CLI 入口:
bin/cli.js
