小程序笔记

1.小程序全局配置app.json

html 复制代码
{
  "pages":[
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Weixin",
    "navigationBarTextStyle":"black"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}

2.小程序全局配置 app.json ----window的配置

"backgroundTextStyle":"light", 下拉 loading 的样式,仅支持 dark / ligh

dark / ligh 为下拉加载出现的小圆点的颜色

"backgroundColor":"#fff000", 窗口的背景色

"navigationBarBackgroundColor": "#fff", 导航栏背景颜色,

"navigationBarTitleText": "Weixin", 导航栏标题文字内容

"navigationBarTextStyle":"black" 导航栏标题颜色,仅支持 black / white

"enablePullDownRefresh":true 是否开启全局的下拉刷新。

"onReachBottomDistance": 100 页面上拉触底事件触发时距页面底部距离,单位为 px。

注意:

  1. json文件中不能写注释

  2. 前两条配置都必须开启下拉刷新才有效果

3.小程序全局配置 app.json ----tabBar的配置

"tabBar"和"window"是并列关系

有一些配置项的颜色只接收十六进制

tabBar最少设置2个,最 多5个

color: tab 上的文字默认颜色,仅支持十六进制颜色

selectedColor: tab 上的文字选中时的颜色,仅支持十六进制颜色

backgroundColor: tab 的背景色,仅支持十六进制颜色

borderStyle: tabbar 上边框的颜色, 仅支持 black / white

position: tabBar 的位置,仅支持 bottom / top

ist中的iconPath: 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图 片。当 position 为 top 时,不显示 icon。

list中的selectedIconPath: 选中时的图片路径

javascript 复制代码
"tabBar": {
    "color": "#f96677",
    "selectedColor":"#567788",
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath":"/images/icon1.jpg",
        "selectedIconPath":"/images/icon2.jpg"
      },
      {
        "pagePath": "pages/list/list",
        "text": "列表"
      },
      {
        "pagePath": "pages/detail/detail",
        "text": "详情"
      },
      {
        "pagePath": "pages/logs/logs",
        "text": "日志"
      }
    ]
}
相关推荐
西岸行者4 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
starlaky4 天前
Django入门笔记
笔记·django
勇气要爆发4 天前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达
悠哉悠哉愿意4 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
勇气要爆发4 天前
吴恩达《LangChain LLM 应用开发精读笔记》2-Models, Prompts and Parsers 模型、提示和解析器
android·笔记·langchain
qianshanxue114 天前
计算机操作的一些笔记标题
笔记
土拨鼠烧电路4 天前
笔记11:数据中台:不是数据仓库,是业务能力复用的引擎
数据仓库·笔记
土拨鼠烧电路4 天前
笔记14:集成与架构:连接孤岛,构建敏捷响应能力
笔记·架构
烟花落o4 天前
栈和队列的知识点及代码
开发语言·数据结构·笔记·栈和队列·编程学习
吴声子夜歌4 天前
小程序——布局示例
小程序