<!--pages/index/search.wxml-->
<import src="/templates/load-more.wxml" />
<import src="templates/shop.wxml" />
<import src="templates/goods.wxml" />
<view class="weui-search-bar">
  <view class="weui-search-bar__form">
    <view class="weui-search-bar__box">
      <icon class="weui-icon-search_in-box" type="search" size="14"></icon>
      <input type="text" class="weui-search-bar__input" placeholder="搜索" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
      <view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
        <icon type="clear" size="14"></icon>
      </view>
    </view>
    <label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
      <icon class="weui-icon-search" type="search" size="14"></icon>
      <view class="weui-search-bar__text">搜索</view>
    </label>
  </view>
  <view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view>
</view>
<view wx:if="{{inputVal}}">
  <view class="search-list">
    <template is="{{item.goods_id ? 'goods' : 'shop'}}" wx:for="{{list}}" wx:key="{{index}}" data="{{...item}}"></template>
  </view>

  <template is="load-more" data="{{loading: loading, hasMore: hasMore}}"></template>
</view>