Commit 185f881c9eb1ff65de80275bccac4759b60e753d

Authored by yvan.ni
1 parent 5a5cb2df

id的优化

components/com_top_nav/com_top_nav.js
1 var t = getApp(),os = t.globalData.setting; 1 var t = getApp(),os = t.globalData.setting;
2 Component({ 2 Component({
3 - properties: {}, 3 + properties: {
  4 + title:{
  5 + type: String,value: '你好'
  6 + },
  7 + bcolor:{
  8 + type: String,value: '#fff'
  9 + },
  10 + color:{
  11 + type: String,value: '#313131'
  12 + }
  13 + },
4 data: { 14 data: {
5 iurl: os.imghost, 15 iurl: os.imghost,
6 height:0, 16 height:0,
components/com_top_nav/com_top_nav.wxml
1 -<view class="t_nav" style="height:{{height}}px">  
2 - <view style="height:{{h1}}px"></view>  
3 - <view class="contant" style="height:{{h2}}px">  
4 - <view>你好</view>  
5 - <view class="tab">ID:454545</view>  
6 - </view>  
7 -</view> 1 +<cover-view class="t_nav" style="height:{{height}}px;background-color:{{bcolor}};color:{{color}}">
  2 + <cover-view style="height:{{h1}}px"></cover-view>
  3 + <cover-view class="contant" style="height:{{h2}}px">
  4 + <cover-view class="title_set">{{title}}</cover-view>
  5 + <cover-view class="tab">ID:454545</cover-view>
  6 + </cover-view>
  7 +</cover-view>
8 <!-- 用于顶开层的高 --> 8 <!-- 用于顶开层的高 -->
9 -<view style="height:{{height}}px"></view>  
10 \ No newline at end of file 9 \ No newline at end of file
  10 +<cover-view style="height:{{height}}px"></cover-view>
11 \ No newline at end of file 11 \ No newline at end of file
components/com_top_nav/com_top_nav.wxss
1 -.t_nav{ color: #313131; position:fixed;top:0;left:0; width:100%;z-index:9999; background-color: #fff }  
2 -.tab{ font-size:24rpx; position: absolute; right: 24rpx; top:-30rpx }  
3 -.contant{ display: flex; justify-content: center; align-items: center; width: 100%; position: relative }  
4 \ No newline at end of file 1 \ No newline at end of file
  2 +.t_nav{ color: #313131; position:fixed;top:0;left:0; width:100%;z-index:9999; background-color: #fff;font-size: 30rpx }
  3 +.title_set{ }
  4 +.tab{ font-size:24rpx; position: absolute; right: 24rpx; top:-32rpx }
  5 +.contant{ display: flex; justify-content: center; align-items: center; width: 100%; position: relative }