qianqianyiyu

小程序动态设置页面背景色、

 1.当前页面下的html文件  给外层view 取个page 类名,下面是css

   .page {

    display: block; 

    min-height: 100%;

    width: 100%;

    position: absolute;

    left: 0;

    top: 0;

    z-index: 1;

  }

 2. 在js 中,获取参数,根据参数类型不同设置不同的 color ,data:{ color:\'red\'}

3.赋值给最外层的view 

<view class="page" style="{{color}};">
  balabala
</view>

二 、导航栏背景色

 wx.setNavigationBarColor({
        frontColor: \'#ffffff\', //必填
        backgroundColor: \'#F32446\', //必填
        // animation: { //可选
        //   duration: 400,
        //   timingFunc: \'easeIn\'
        // }
      });

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2021-11-26
  • 2021-04-01
  • 2022-01-01
  • 2021-11-06
  • 2021-11-26
  • 2021-07-25
  • 2021-11-26
猜你喜欢
  • 2021-04-14
  • 2022-01-01
  • 2022-01-01
  • 2021-11-26
  • 2021-12-06
  • 2021-12-21
相关资源
相似解决方案