微信小程序 - 下拉列表的实现
微信小程序目前提供两种方式实现下拉列表:action-sheet 与 picker选择器
action-sheet
action-sheet 有两种方法实现下拉,第一种使用action-sheet 标签,第二种是使用wx.showActionSheet方法
(1)action-sheet 标签
<action-sheet bindchange="actionSheetChange" hidden="{
{actionType}}">
<block wx:for="{
{actionSheetItems}}" wx:key="*this">
<action-sheet-item class="item" bindtap="bindItemTap" data-name="{
{item}}">
{
{item}}
</action-sheet-item>
</block>
<action-sheet-cancel class="cancel">取消</action-sheet-cancel>
</action-sheet>
<view>
<input type="text" name="type" value="{
{addTypeData}}" disabled="{
{addTypeDis}}"
bindfocus="addType" placeholder="请输入所在城市" style="border:1px solid black;margin:15px;"/>
</view>