微信小程序学习日记day1

全局文件的设置

1.新增一个页面

当你想新建一个页面时,直接在app.json中加入page字段值,如图,保存后,系统自动创建一个页面

请添加图片描述

2.主界面设置

将主界面文件在app.json中page值放在最前面即可。

请添加图片描述

3.Window字段常用属性

  1. navigationBarBackgroundColor:顶部导航栏颜色设置

请添加图片描述

  1. navigationBarTitleText:标题名称

在这里插入图片描述

  1. navigationBarTextStyle:“white” 标题字的颜色,只有黑色白色两种颜色

在这里插入图片描述

  1. enablePullDownRefresh:true 下拉刷新,将backgroundTextStyle改为dark可以看到刷新时:

在这里插入图片描述

​ backgroundTextStyle:下拉字体颜色

  1. “backgroundColor”: “#0094ff” 下拉时下拉小块背景变色

在这里插入图片描述

4.tabbar字段:底部导航栏

  "tabBar": {
    "list": [
      {
        "pagePath": "pagePath",
        "text": "text",
        "iconPath": "iconPath",
        "selectedIconPath": "selectedIconPath"
      }
    ]  
  },
  1. pagePath:跳转到的页面路径。和pages的路径一样
  2. text:名称
  3. iconPath:未激活的按钮图标路径:图片路径就是文件夹名/图片名
  4. selectedIconPath:被选中的按钮图标路径
注意:

至少需要两项才能形成导航栏

  1. 依次建立导航栏如图所示
    在这里插入图片描述

  2. 更改底部文字默认颜色和被选中时的颜色

注意:

tabBar其他属性是和list属性同级,不要放错

  1. 常用属性:

    “color”: “#0094ff” , 默认字体颜色

    “selectedColor”: “#ff9400”, 被选中后字体颜色

    “backgroundColor”: “#ff5533”, 背景颜色

    “position”: “bottom” 按钮在底部,在顶部隐藏图标

在这里插入图片描述

{
  "pages":[
    "pages/index/index",
    "pages/img/img",
    "pages/mine/mine",
    "pages/search/search",
    "pages/demo01/demo01",
    "pages/demo02/demo02",
    "pages/logs/logs"
    
  ],
  "window":{
    "backgroundTextStyle":"dark",
    "navigationBarBackgroundColor": "#0094ff",
    "navigationBarTitleText": "我的应用",
    "navigationBarTextStyle":"white",
    "enablePullDownRefresh": true,
    "backgroundColor": "#0094ff"
  },
  "tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "icon/_home.png",
        "selectedIconPath": "icon/home.png"
      },
      {
        "pagePath": "pages/img/img",
        "text": "图片",
        "iconPath": "icon/_img.png",
        "selectedIconPath": "icon/img.png"
      },
      {
        "pagePath": "pages/mine/mine",
        "text": "我的",
        "iconPath": "icon/_my.png",
        "selectedIconPath": "icon/my.png"
      },
      {
        "pagePath": "pages/search/search",
        "text": "搜索",
        "iconPath": "icon/_search.png",
        "selectedIconPath": "icon/search.png"
      }
    ] 
    ,
    "color": "#0094ff" ,
    "selectedColor": "#ff9400",
    "backgroundColor": "#ff5533",
    "position": "bottom"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}


  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

伊可同学

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值