背景
在做微信小程序时列表页是最常见的页面,多数包括列顶部搜索框,下面紧贴着可上下滑动的列表:
1.微信小程序帮助文档较为简陋,不便于上手直接使用。
我希望通过个人的实践总结帮助大家更快上手使用。
实现
搜索框
.wxml文件
<view class="search-wrap">
<icon type="search" size="16" class="icon-search" />
<input type="text" placeholder="请输入搜索内容" class="search-input" name="searchKeyword" bindinput="bindKeywordInput" value="{
{searchKeyword}}" />
</view>
<!-- <view class="search-cancel" bindtap="keywordSearch">搜索</view> -->
<view class="search-cancel" bindtap="keywordAdd">添加</view>
</view>
页面顶部搜索框,如图