search.wxml 2.4 KB
<!--pages/service/renting/search/search.wxml-->
<view class="container">
    <view class="head_search_box">
        <view class="input">
            <image src="../../images/search@2x.png"></image>
            <input placeholder='请输入搜索相关内容' bindfocus="inputFocus" bindinput="inputKey" value="{{searchValue}}" bindconfirm="startSearch" placeholder-class='input_size'/>
            <view class="iconfont icon-jia1 jia1" catchtap="clearInput"></view>
        </view>
        <!--<view class="search-text" bindtap="startSearch">搜索</view>-->
    </view>

    <view class="history_box" wx:if="{{postList.length<=0}}">
        <view class="head">
            <view class="title">热门搜索</view>
        </view>

        <view class="history_list {{searchHistory.length === 0?'text-center':''}}">
            <text wx:if="{{searchHistory.length === 0}}">暂无搜索历史~</text>
            <view  wx:elseif wx:for="{{searchHistory}}" wx:key="index" bindtap="clickHistory" data-index="{{index}}">{{item.keyword}}</view>
        </view>
    </view>

    <view class="history_box history" wx:if="{{postList.length<=0}}">
        <view class="head">
            <view class="title">搜索历史</view>
            <view class="clear" bindtap="clearHistory">
                <view class="iconfont icon-shanchu"></view>
                <text>清空历史记录</text>
            </view>
        </view>

        <view class="history_list {{searchHistory.length === 0?'text-center':''}}">
            <text wx:if="{{searchHistory.length === 0}}">暂无搜索历史~</text>
            <view  wx:elseif wx:for="{{searchHistory}}" wx:key="index" bindtap="clickHistory" data-index="{{index}}">{{item.keyword}}</view>
        </view>
    </view>

    <!--文章内容-->
    <view class='content_box post_box' wx:if="{{postList.length > 0}}">
        <view class='content_item' wx:for="{{postList}}" wx:key="index" bindtap='goPostDetail' data-index="{{index}}">
            <image src="../../images/lishi@2x.png" class="thumb"></image>
            <view class="lish-right">
                <view class="title">{{item.title}}</view>
                <view class="time">{{item.time}}</view>
                <view class="name-box">
                    <image src="../../images/avatar@2x.png" class="avatar"></image>
                    <text>{{item.name}}</text>
                </view>
            </view>
        </view>
    </view>
</view>