Taro3 的自动生成
pages
配置插件,以后不用每次添加页面都修改app.config.js
文件。 插件会自动寻找src/pages
下的所有index
页面,生成src/.tmp/pages.js
文件, 然后将pages.js
导入app.config.js
中使用。
npm i taro-plugin-auto-pages --dev
// or
yarn add taro-plugin-auto-pages --dev
// step1 配置插件
const config = {
plugins: [
['taro-plugin-auto-pages',
{
indexPath: 'pages/demo/index' // 默认 pages/index/index
}
],
]
}
// step2 修改 app.config.js
import pages from './.temp/pages';
export default {
pages,
window: {},
...
}
- 新增页面需要重启服务
- ...
2021-04-26(v0.1.3)
- fix: taro 从 3.0.18 升级到 3.2.5 时 platform 参数获取报错
2020-08-25(v0.1.1)
- fix 编译 h5 时忽略处理
2020-08-25(v0.1.0)
- 代码重构
- 添加
indexPath
参数用于配置首页,默认pages/index/index