Commit b22e0a6676a9c9bc82b565b51ed1a25dfdbc8f04

Authored by yvan.ni
1 parent a87d3338

小程序自定义模板要能够固定在顶部

components/diy_searchbox/diy_searchbox.wxml
1 <!--pages/diy_ss/diy_ss.wxml--> 1 <!--pages/diy_ss/diy_ss.wxml-->
2 -<view class='ss' wx:if="{{object.style==1}}">  
3 - <view bindtap='go_url' data-url="/pages/goods/search/search" class="s1_gk_a1">  
4 - <view class='s_ge'>  
5 - <image src='{{imghost}}/miniapp/images/search.png'></image>  
6 - <text>在店铺内搜索</text>  
7 - </view>  
8 - </view> 2 +<block wx:if="{{object.style==1}}">
  3 +<view class="{{object.is_top==1?'abs_top':''}}">
  4 + <view class='ss' >
  5 + <view bindtap='go_url' data-url="/pages/goods/search/search" class="s1_gk_a1">
  6 + <view class='s_ge'>
  7 + <image src='{{imghost}}/miniapp/images/search.png'></image>
  8 + <text>在店铺内搜索</text>
  9 + </view>
  10 + </view>
  11 + </view>
9 </view> 12 </view>
  13 +<view wx:if="{{object.is_top}}" style="height: 120rpx;"></view>
  14 +</block>
  15 +
  16 +
  17 +<block wx:if="{{object.style==2}}">
10 18
11 -<view class='ss2' wx:if='{{object.style==2}}' style='background-color:{{object.top_bgcolor}}'> 19 +<view class="ss2 {{object.is_top==1?'abs_top2':''}}" style='background-color:{{object.top_bgcolor}}' >
12 <view class='s2_left'> 20 <view class='s2_left'>
13 <navigator url="/pages/index/index/index" class="s1_gk_a1"> 21 <navigator url="/pages/index/index/index" class="s1_gk_a1">
14 <image src='/public/static/images/model/nav.png'></image> 22 <image src='/public/static/images/model/nav.png'></image>
@@ -18,7 +26,7 @@ @@ -18,7 +26,7 @@
18 <view class='s2_cen' style='background-color:{{object.inner_bgcolor}}'> 26 <view class='s2_cen' style='background-color:{{object.inner_bgcolor}}'>
19 <navigator url="/pages/goods/search/search" class="s1_gk_a2"> 27 <navigator url="/pages/goods/search/search" class="s1_gk_a2">
20 <image src='/public/static/images/model/select.png'></image> 28 <image src='/public/static/images/model/select.png'></image>
21 - <text>在店铺内搜索</text> 29 + <text>在店铺内搜索-{{object.is_top}}</text>
22 </navigator> 30 </navigator>
23 </view> 31 </view>
24 32
@@ -27,4 +35,8 @@ @@ -27,4 +35,8 @@
27 <image src='/public/static/images/model/car.png'></image> 35 <image src='/public/static/images/model/car.png'></image>
28 </navigator> 36 </navigator>
29 </view> 37 </view>
30 -</view>  
31 \ No newline at end of file 38 \ No newline at end of file
  39 +</view>
  40 +
  41 +<view wx:if="{{object.is_top==1}}" style="height: 100rpx;"></view>
  42 +
  43 +</block>
32 \ No newline at end of file 44 \ No newline at end of file
components/diy_searchbox/diy_searchbox.wxss
@@ -75,4 +75,12 @@ margin-top:20rpx; @@ -75,4 +75,12 @@ margin-top:20rpx;
75 width: 35rpx; 75 width: 35rpx;
76 height: 30rpx; 76 height: 30rpx;
77 margin-left: 20rpx; 77 margin-left: 20rpx;
  78 +}
  79 +
  80 +.abs_top{
  81 + position: fixed; z-index: 10; background-color: #fff;
  82 +}
  83 +
  84 +.abs_top2{
  85 + position: fixed; z-index: 10;
78 } 86 }
79 \ No newline at end of file 87 \ No newline at end of file