微信小程序> 小程序开发API之改变背景色及下拉字体与loading图样式wx.setBackgroundTextStyle、wx.setBackgroundColor

小程序开发API之改变背景色及下拉字体与loading图样式wx.setBackgroundTextStyle、wx.setBackgroundColor

浏览量:4406 时间: 来源:钢丝球 M.Siebel

效果展示


小程序

wx.setBackgroundTextStyle(Object object)

动态设置下拉背景字体、loading 图的样式

wx.setBackgroundTextStyle参数

小程序

object.textStyle 的合法值小程序

wx.setBackgroundColor(Object object)

动态设置窗口的背景色

wx.setBackgroundColor参数小程序

例如:
效果展示


小程序

代码
首先先设置可以下拉
index.json

{  "enablePullDownRefresh": true}

index.wxml

button bindtap="btnClick1" type="primary"改变下拉背景字体、loading 图的样式/buttonbutton bindtap="btnClick2" type="primary"动态改变窗口的背景色为黑色/buttonbutton bindtap="btnClick3" type="primary"动态底部窗口的上面为红,下面为绿/button

index.wxss

page{  background-color: lightblue}button{  margin: 20rpx;}

index.js

/*  wx.setBackgroundTextStyle属性  textStyle 下拉背景字体、loading 图的样式。 dark 样式和light 样式  wx.setBackgroundColor属性  backgroundColor  窗口的背景色,必须为十六进制颜色值  backgroundColorTop  顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持  backgroundColorBottom  底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持*/Page({  data: {   },  btnClick1:function(){    wx.setBackgroundTextStyle({      textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark    })  },  btnClick2: function () {    wx.setBackgroundColor({      backgroundColor: '#000000', // 窗口的背景色为黑色    })  },  btnClick3: function () {    wx.setBackgroundColor({      backgroundColorTop: '#DC143C', // 顶部窗口的背景色为红      backgroundColorBottom: '#   #00FA9A', // 底部窗口的背景色为绿    })  }})





版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

最新资讯

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎