【微信小程序】全局配置

1. 全局配置文件及常用的配置项

2.window

(1).小程序窗口的组成部分

(2). 了解 window 节点常用的配置项

(3). 设置导航栏的标题


(4). 设置导航栏的背景色


(5). 设置导航栏的标题颜色



(6). 全局开启下拉刷新功能

(7). 设置下拉刷新时窗口的背景色


(8).设置下拉刷新时 loading 的样式



(9).设置上拉触底的距离

3.tabBar

(1).什么是 tabBar


(2).tabBar 的 6 个组成部分


(3).tabBar 节点的配置项

(4).每个 tab 项的配置选项

4.案例:配置 tabBar

(1).需求描述


(2).实现步骤

步骤1 - 拷贝图标资源


步骤2 - 新建 3 个对应的 tab 页面



步骤3 - 配置 tabBar 选项

完整的配置代码

javascript 复制代码
{
  "pages": [
    "pages/home/home",
    "pages/message/message",
    "pages/contact/contact"
  ],
  "window": {
    "navigationBarTextStyle":"black",
    "navigationBarTitleText": "微信小程序",
    "navigationBarBackgroundColor": "#00ffff",
    "backgroundColor": "#eee",
    "enablePullDownRefresh": true,
    "backgroundTextStyle": "light"
  },
  "style": "v2",
  "componentFramework": "glass-easel",
  "sitemapLocation": "sitemap.json",
  "lazyCodeLoading": "requiredComponents",
  "tabBar": {
    "list": [
      {
      "pagePath": "pages/home/home",
      "text": "首页",
      "iconPath": "images/tabs/home.png", //相对路径
      "selectedIconPath": "images/tabs/home-active.png"
    },
      {
      "pagePath": "pages/message/message",
      "text": "消息",
      "iconPath": "images/tabs/message.png",
      "selectedIconPath": "images/tabs/message-active.png"
    },
      {
      "pagePath": "pages/contact/contact",
      "text": "联系我们",
      "iconPath": "images/tabs/contact.png",
      "selectedIconPath": "images/tabs/contact-active.png"
    }
  ],
  "color": "#000000",
  "selectedColor": "#ff0000",
  "backgroundColor": "#eee",
  "position":"bottom", // top或者bottom
  "borderStyle": "white"  // white或者black
  }
}
相关推荐
Stanford_110617 小时前
如何利用Python进行数据分析与可视化的具体操作指南
开发语言·c++·python·微信小程序·微信公众平台·twitter·微信开放平台
2501_9159090617 小时前
HTML5 与 HTTPS,页面能力、必要性、常见问题与实战排查
前端·ios·小程序·https·uni-app·iphone·html5
知识分享小能手19 小时前
微信小程序入门学习教程,从入门到精通,微信小程序核心 API 详解与案例(13)
前端·javascript·学习·react.js·微信小程序·小程序·vue
2501_915106321 天前
JavaScript编程工具有哪些?老前端的实用工具清单与经验分享
开发语言·前端·javascript·ios·小程序·uni-app·iphone
Terio_my1 天前
微信小程序开发从零基础到项目发布的全流程实战教程(四)
微信小程序·小程序
2501_916013741 天前
iOS 上架 App 全流程实战,应用打包、ipa 上传、App Store 审核与工具组合最佳实践
android·ios·小程序·https·uni-app·iphone·webview
2501_915106321 天前
iOS 26 能耗监测全景,Adaptive Power、新电池视图
android·macos·ios·小程序·uni-app·cocoa·iphone
Stanford_11061 天前
关于嵌入式硬件需要了解的基础知识
开发语言·c++·嵌入式硬件·微信小程序·微信公众平台·twitter·微信开放平台
明月(Alioo)1 天前
用AI帮忙,开发刷题小程序:软考真经微信小程序API接口文档(更新版)
微信小程序·小程序
克里斯蒂亚诺更新1 天前
微信小程序的页面生命周期 以及onShow的应用场景
微信小程序·小程序