小程序 - 冷知识点总结

  1. 微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。

  2. 动态改变下拉刷新的背景色:(针对IOS的下拉刷新和弹性上拉问题)

     json: 	   "backgroundColor": "#F00"
     onShow:  	wx.setBackgroundColor({
     			  backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
     			  backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
     			})   (根据实际情况判断是否需要添加定时器)
    
  3. 动态设置 tabBar 的整体样式

     wx.setTabBarStyle({
       color: '#FF0000',
       selectedColor: '#00FF00',
       backgroundColor: '#0000FF',
       borderStyle: 'white'
     })
    
  4. 动态设置 tabBar 某一项的内容,2.7.0 起图片支持临时文件和网络文件。

     wx.setTabBarItem({
       index: 0,
       text: 'text',
       iconPath: '/path/to/iconPath',
       selectedIconPath: '/path/to/selectedIconPath'
     })
    

猜你喜欢

转载自blog.csdn.net/jiaodeqiangs/article/details/102458229