init
This commit is contained in:
33
scripts/fix-app-json.js
Normal file
33
scripts/fix-app-json.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
// 修复 dist/app.json,确保 tabBar.list 存在
|
||||
const appJsonPath = path.join(__dirname, '../dist/app.json')
|
||||
|
||||
if (fs.existsSync(appJsonPath)) {
|
||||
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'))
|
||||
|
||||
// 如果 tabBar 存在但没有 list,添加 list
|
||||
if (appJson.tabBar && !appJson.tabBar.list) {
|
||||
appJson.tabBar.list = [
|
||||
{
|
||||
pagePath: 'pages/home/index',
|
||||
text: '首页',
|
||||
iconPath: 'assets/tabbar/home.png',
|
||||
selectedIconPath: 'assets/tabbar/home-active.png'
|
||||
},
|
||||
{
|
||||
pagePath: 'pages/check/index',
|
||||
text: '质检',
|
||||
iconPath: 'assets/tabbar/check.png',
|
||||
selectedIconPath: 'assets/tabbar/check-active.png'
|
||||
}
|
||||
]
|
||||
|
||||
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2), 'utf8')
|
||||
console.log('✅ 已修复 dist/app.json 中的 tabBar.list')
|
||||
}
|
||||
} else {
|
||||
console.log('⚠️ dist/app.json 不存在,跳过修复')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user