Wechat----components 搜索组件2

components 搜索组件2
index.json 引用所需组件
{
  "component": true,
  "usingComponents": {
    "v-tag" : "/components/tag/index",
    "v-book": "/components/book/index",
    "v-loading": "/components/loading/index"
  }
}
index.wxml
<view class="container">

  <!-- header -->
  <view class="header">
    <view class="search-container">
      <image class="icon" src="images/search.png" />
      <input bind:confirm="onConfirm" value="{{q}}" placeholder-class='in-bar' placeholder='书籍名' class='bar'  auto-focus="true" />
      <image bind:tap="onDelete" class="cancel-img" src="images/cancel.png" />
    </view>
    <view class='cancel' bind:tap="onCancel">取消</view>
  </view>

  <!-- 历史搜索,热门搜索 -->
  <view wx:if="{{!searching}}">
    <view class="history">
      <view class="title">
        <view class="chunk"></view>
        <text>历史搜索</text>
      </view>

      <view class="tags">
        <v-tag bind:tapping="onConfirm" wx:key="" wx:for="{{historyWords}}" text="{{item}}" />
      </view>
    </view>

    <view class="history hot-search">
      <view class="title">
        <view class="chunk"></view>
        <text>热门搜索</text>
      </view>
        <view class="tags">
          <block wx:key="" wx:for="{{hotWords}}">
          <v-tag bind:tapping="onConfirm" text="{{item}}" />
          </block>
        </view>
    </view>
  </view>

  <!--  books -->
  <view class="books-container" wx:if="{{searching}}">
    <block wx:for="{{dataArray}}" wx:key="{{item.id}}">
      <v-book show-like="{{false}}" book="{{item}}" class="book" />
    </block>
  </view>


  <!-- loading -->
  <v-loading class='loading-center' wx:if="{{showLoadingIcon}}"/>
  <v-loading class="loading-bottom" wx:if="{{loading}}" />

  <view class='empty-tip' wx:if="{{noneResult}}">没有搜索到书籍</view>

</view>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值