app直播源代码,自定义顶部搜索栏显示隐藏

发布时间 2023-07-10 14:13:51作者: 云豹科技-苏凌霄

app直播源代码,自定义顶部搜索栏显示隐藏

1、wxml代码

 


<view class="bar-box" style="height: {{navBarHeight}}px;">
    <view wx:if="{{show}}" class="level" style="margin-top: {{barHeight}}px;">
        <view class="level bar">
            <icon class="icon-small" type="search" size="20"></icon>
            <input placeholder="输入关键字" class="input-text" disabled="true" bindtap="searchClick" />
        </view>
    </view>
    <view class="bar-title" style="margin-top: {{barHeight}}px;" wx:else>滑动切换搜索框</view>
</view>
<!-- 搜索 -->
<view class="level search-box" style="padding-top: {{navBarHeight}}px;">
    <view class="level col">
        <icon type="search" size="20"></icon>
        <input placeholder="输入关键字" class="input-text" disabled="true" bindtap="searchClick" />
    </view>
</view>
<!-- 下面为方便测试,模拟写的高度,可删除 -->
<view style="height: 900px;"></view>
 

2、wxss代码

 


page {
   
}
.level {
    display: flex;
    align-items: center;
}
/* 状态栏 */
.bar-box {
    background-color: #66cccc;
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999;
}
.bar-title {
    padding-top: 3%;
    text-align: center;
    font-size: 34rpx;
    color: white;
}
.bar {
    width: 80%;
    padding: 10rpx;
    border-radius: 50rpx;
    background-color: white;
    margin-right: 30%;
    margin-top: 1.5%;
    margin-left: 20rpx;
}
/* 搜索 */
.search-box {
    padding: 20rpx 0;
}
.col {
    width: 100%;
    padding: 15rpx 10rpx;
    border-radius: 50rpx;
    background-color: white;
    margin: 20rpx;
    box-shadow: 0 3rpx 3rpx 3rpx gray;
}
.input-text {
    font-size: 30rpx;
    padding-left: 10rpx;
}
 

 

3、json代码

 


{
    "usingComponents": {},
    "navigationStyle": "custom"
}

 

 以上就是 app直播源代码,自定义顶部搜索栏显示隐藏,更多内容欢迎关注之后的文章