更新记录
1.0.03(2024-04-23)
- 优化;
1.0.02(2024-04-20)
新增 Options.customTabBar 是否自定义 tabBar;注:开启自定义 tabBar 时,会读取主包下的文件生成 { tabBar: { list: [{ pagePath: 'pages/index/index' }] } };因为 uniapp 不管是不是自定义如果有 tabBar 页 pages.json 需要必须存在 tabBar 配置
1.0.01(2024-04-20)
-
新增 Options.autoAormat 是否自动格式配置;注:
根据主包文件名/分包规则重新排序。如:{ pages: [{ path: 'pages/index/index' }] } 自动转 { subPackages: [{ root: 'pages/index', pages: [{ path: 'index' }] }] }
-
解决部分
mac
环境JSON.parse
无法解析json
字符串 -
优化一套代码运行多个平台;注:
同时运行多个平时时,必须【重新运行】而不是【暂停在运行】
平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
app-vue app-nvue app-uvue | √ | √ | √ | √ | √ | √ |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |
---|---|---|---|
√ | √ | √ | √ |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ | √ | √ | √ |
根据文件自动生成 pages.json
配置
Usage
/** vite.config.js */
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import autoPagesJson from './js_sdk/a-hua-auto-pages-json';
export default defineConfig({
plugins: [
uni(),
autoPagesJson()
// autoPagesJson({
// tabBar: 'tab-bar',
// entrance: 'pages',
// autoAormat: false,
// customTabBar: true,
// subPackages: true || ['pages/home', 'home'],
// pageConfig: {
// disableScroll: true,
// enablePullDownRefresh: false,
// "app-plus": { bounce: "none" }
// },
// tabBarPageConfig: {
// disableScroll: true,
// enablePullDownRefresh: false,
// "app-plus": { bounce: "none" }
// },
// subPackagesConfig: {
// disableScroll: true,
// enablePullDownRefresh: false,
// "app-plus": { bounce: "none" }
// }
// })
]
});
/**
* *.json 某个页面配置;当然也可以手动在 pages.json 中配置;
* 如:页面路径 pages/index/index.vue;页面配置:pages/index/index.json;
* 注:配置类型:PageOptions uniapp [页面配置](https://uniapp.dcloud.net.cn/collocation/pages.html#pages)`
*/
Options
- tabBar
type:
string
default:tab-bar
explain:主包文件名
- entrance
type:
string
default:pages
explain:页面根目录
- autoAormat
type:
boolean
default:false
explain:是否自动格式配置;注:根据主包文件名/分包规则重新排序
/** 假设 pages.json 如下: */
{ pages: [{ path: 'pages/index/index' }] }
/** 根据配置把上面代码转化后如下: */
{ subPackages: [{ root: 'pages/index', pages: [{ path: 'index' }] }] }
- pageConfig
type:
PageOptions
explain:uniapp页面配置
default:
// 注:`app-plus` 只有 app 环境生效
{ disableScroll: true, enablePullDownRefresh: false, { "app-plus": { bounce: "none" } } }
- subPackages
type:
string[] / boolean
default:true
explain:是否开启分包/分包路径;如:['pages/home', 'home']
注:此属性不是 H5 环境生效
- customTabBar
type:
boolean
default:false
explain:是否自定义tabBar
;注:开启自定义tabBar
时,会读取主包下的文件生成
{ tabBar: { list: [{ pagePath: 'pages/index/index' }] } }
// 解:因为 uniapp 不管是不是自定义如果有 tabBar 页 pages.json 需要必须存在 tabBar 配置
- tabBarPageConfig
type:
PageOptions
explain:uniapp主包页面配置
default:
// 注:`app-plus` 只有 app 环境生效
{ disableScroll: true, enablePullDownRefresh: false, { "app-plus": { bounce: "none" } } }
- subPackagesConfig
type:
PageOptions
explain:uniapp分包页面配置
default:
// 注:`app-plus` 只有 app 环境生效
{ disableScroll: true, enablePullDownRefresh: false, { "app-plus": { bounce: "none" } } }
Contact
欢迎大家提供建议。
wx:_____ahua
phone:15850531310
email:cvsq@icloud.com