小程序的配置文件

kk3TWT Lv2

app.json文件

小程序的全局配置文件,包含小程序的所有页面路径、窗口外观、界面表现等,主要包含以下几个配置项:

  • pages:所有页面的路径
  • window:页面背景色、文字颜色等
  • style:组件所使用的样式版本
  • sitemapLocation:sitemap.json的路径
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"pages": [
"pages/index/index",
"pages/logs/logs"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "Weixin",
"navigationBarBackgroundColor": "#ffffff"
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

project.config.json文件

项目配置文件,用于对编辑器的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"compileType": "miniprogram",
"libVersion": "trial",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"minifyWXML": true,
"localPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true,
"disableUseStrict": false,
"useCompilerPlugins": false
},
"condition": {},
"editorSetting": {
"tabIndent": "auto",
"tabSize": 2
},
"appid": null,
"simulatorPluginLibVersion": {}
}

sitemap.json文件

配置小程序页面是否允许微信索引

当开发者允许微信索引时,若用户的搜索关键字和页面的索引匹配成功,小程序的页面就将展示在用户的搜索结果中

1
2
3
4
5
6
7
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

.json文件

用于配置不同页面的窗口外观,这种文件的配置项将会覆盖 app.jsonwindow 配置项的内容

1
2
3
4
5
6
// 这应该是一个空的json文件,可以在这基础上添加很多标签

{
"usingComponents": {
}
}
  • 标题: 小程序的配置文件
  • 作者: kk3TWT
  • 创建于 : 2026-04-05 19:28:03
  • 更新于 : 2026-04-05 20:23:33
  • 链接: https://kk-is-very-happy.online/posts/ea6498c/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
目录
小程序的配置文件