zoukankan      html  css  js  c++  java
  • 小程序自定义headed 头部

    <!-- 组件 custom-component.wxml -->
    
    <view class='flex commonHead top' 
      style='color:{{navbarBg.topColor == "#ffffff"?"#000000":"#ffffff"}};background-color:{{navbarBg.topColor}};height:{{commonHeadHeight.titleHeight}}px;'>
      <view class='commonHead-wrap flex'>
        <view class='commonHead_left' style="height:{{commonHeadHeight.titleHeight - commonHeadHeight.statusBarHeight}}px;line-height:{{commonHeadHeight.titleHeight - commonHeadHeight.statusBarHeight}}px;">
          <text>霸王餐</text>
        </view>
        <view class='commonHead_right flex' style="height:{{commonHeadHeight.titleHeight - commonHeadHeight.statusBarHeight}}px;">
          <view class='commonHead_right_text line1' bindtap="onRouter">
            <view class="search" style='background-color:{{navbarBg.topColor == "#ffffff"?"#f1f1f1":"rgba(255, 255, 255, 0.57)"}}'>
              <image src="../../../image/BWC/search.png" wx:if="{{navbarBg.topColor == '#ffffff'}}"></image>
              <image src="../../../image/BWC/search.png" wx:else></image>
              <text>{{navbarData.name}}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    Component({
      properties: {
        navbarData: {
          type: Object,
          value: {
            "bg_color": "white",
            "color": "#000",
            "flag": 1,
            "name": "搜索好物"
          }
        },
        navbarBg: {
          type: Object,
          value: {
            'topColor': 'transparent'
          }
        },
        commonHeadHeight: {
          type: Object,
          value: {}
        }
      },
      data: {
        navbarBg: {}
      }, // 私有数据,可用于模版渲染
    
      lifetimes: {
        // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
        attached: function () { },
        moved: function () { },
        detached: function () { },
      },
      // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
      attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
      ready: function () {
        var that = this;
        wx.getSystemInfo({
          success(res) {
            that.setData({
              "commonHeadHeight.statusBarHeight": res.statusBarHeight -4,
              "commonHeadHeight.titleHeight": res.statusBarHeight + 50,
            });
    
          }
        })
      },
      pageLifetimes: {},
      methods: {}
    })
    

      

  • 相关阅读:
    POJ-3984-迷宫问题(bfs+记录路径)
    StringBuilder与String的区别
    845. 八数码(bfs+map)
    844. 走迷宫(bfs模板)
    843. n-皇后问题(dfs+输出各种情况)
    洛谷 P1337 [JSOI2004]平衡点 / 吊打XXX
    【模板】 线性筛质数
    接文游戏
    【NOIP2011提高组】计算系数
    洛谷 P3197 [HNOI2008]越狱
  • 原文地址:https://www.cnblogs.com/baifubin/p/11880199.html
Copyright © 2011-2022 走看看