0
点赞
收藏
分享

微信扫一扫

小程序笔记6WXSS模板样式、全局配置(window和tabBar)、页面配置(含代码以及案例开发)

 (二)rpx

  • 什么是rpx

  •  rpx的实现原理

  •  rpx与px之间的单位换算*

 (三)样式导入 

  • 什么是样式导入 

  • @import的语法

@import"/common/common.wxss";

(四)全局样式和局部样式

  • 全局样式

app.wxss全局样式

view{
  padding: 10rpx;
  margin: 10rpx;
  background-color: skyblue;
}
  • 局部样式

/* 范围越小权重越大 */
view:nth-child(1){
  background-color: red;
}

(五)全局配置文件

(六)全局配置文件

  • window

  • 了解window节点常用的配置项

  •  设置导航栏的标题

  •  设置导航栏的背景色

  •  设置导航栏的标题颜色

  •  全局开启下拉刷新功能

  •  设置下拉刷新的背景色

 

 

  • 设置下拉刷新时loading的样式

 

 

  • 设置上拉触底的距离

 (七)tabBar

  • 什么是tabBar

  • tabBar的6个组成部分 

  •  tabBar节点的配置项

  •  每个tab项的配置选项

  •  tabBar案例

 

 

 

 

 

"tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "/images/首页.png",
        "selectedIconPath": "/images/首页 1.png"
      },
      {
        "pagePath": "pages/message/message",
        "text": "消息",
        "iconPath": "/images/消息.png",
        "selectedIconPath": "/images/消息 1.png"

      },
      {
        "pagePath": "pages/test/test",
        "text": "我的",
        "iconPath": "/images/我的.png",
        "selectedIconPath": "/images/我的1.png"
      }
    ]
  },

(八)页面配置

 

 

 (九)网络数据请求

  • 小程序中网络数据请求的限制

  •  配置request合法域名

  • 发起GET请求

 

 

<button bindtap="getInfo">发送GET请求</button>
<button bindtap="postInfo">发送POST请求</button>

 getInfo(){
        wx.request({
        url: 'https://www.escook.cn/api/get',
        method:'GET',
        data:{
            name:'zs',
            age:20
        },
        success:(res)=>{
            console.log(res.data)
        }
        })
    },

 //发起POST请求
    postInfo(){
        wx.request({
          url: 'https://www.escook.cn/api/post',
          method:"POST",
          data:{
              name:'ls',
              age:33
          },
          success:(res)=>{
              console.log(res.data)
          }
        })
    },
  • 发起POST请求

  • 在页面刚加载时请求数据

​​​​​​

 

  • 跳过request合法域名校验

 

  •  关于跨域和Ajax的说明

 

举报

相关推荐

0 条评论