|
113 | 113 | v-model="inFormFields[item.field]" border="none" :ref="item.field" |
114 | 114 | :placeholder="item.placeholder||('请输入'+item.title)"></input> |
115 | 115 | </view> |
116 | | - <view v-if="item.extra" :style="item.extra.style" style="display: flex;" @click="extraClick(item,inFormFields)"> |
117 | | - <u-icon v-if="item.extra.icon" :name="item.extra.icon" :color="item.extra.color" :size="item.extra.size"> |
| 116 | + <view v-if="item.extra" :style="item.extra.style" style="display: flex;" |
| 117 | + @click="extraClick(item,inFormFields)"> |
| 118 | + <u-icon v-if="item.extra.icon" :name="item.extra.icon" :color="item.extra.color" |
| 119 | + :size="item.extra.size"> |
118 | 120 | </u-icon> |
119 | 121 | <text>{{item.extra.text}}</text> |
120 | 122 | </view> |
|
128 | 130 | <!-- 下拉框 --> |
129 | 131 | <u-popup @touchmove.prevent class="form-popup" :zIndex="999999" :show="actionSheetModel" |
130 | 132 | @close="actionSheetModel=false;"> |
131 | | - <view class="vol-action-sheet-select-container" :style="{'max-height':(maxHeight+'px')}"> |
| 133 | + <view class="vol-action-sheet-select-container" :style="{'height':(popupHeight+'px')}"> |
132 | 134 | <view class="vol-action-sheet-select-title">请选择{{actionSheetCurrentItem.title}} |
133 | 135 | <text class="vol-action-sheet-select-confirm" @click="actionConfirmClick">确定</text> |
134 | 136 | </view> |
135 | 137 | <!-- 超过10个下拉框选项默认开启搜索 --> |
136 | | - <!-- <view class="vol-action-sheet-select-filter" |
137 | | - v-show="actionSheetCurrentItem.data&&actionSheetCurrentItem.data.length>=10"> |
138 | | - <view style="padding-left:20rpx;flex:1;font-size: 22px;color: #909399;background: white;"> |
139 | | - <u--input placeholder="请输入关键字搜索" v-model="searchText"> |
| 138 | + <view v-if="showFilter" class="vol-action-sheet-select-filter" > |
| 139 | + <view style="padding-left:20rpx;flex:1;font-size: 22px;color: #909399;background: white;"> |
| 140 | + <u--input placeholder="请输入关键字搜索" v-model="searchText"> |
140 | 141 | </u--input> |
141 | 142 | </view> |
142 | 143 | <view class="search-btn"> |
143 | | - <u-button type="primary" icon="trash" @click="searchText=''" size="small">清除</u-button> |
| 144 | + <u-button :plain="true" :hairline="true" :customStyle="{padding:'10rpx 20rpx'}" shape="circle" type="primary" icon="trash" @click="searchText=''" size="small">清除</u-button> |
144 | 145 | </view> |
145 | | - </view> --> |
| 146 | + </view> |
146 | 147 | <view class="vol-action-sheet-select-content"> |
147 | 148 | <view :class="{'vol-action-sheet-select-actived':actionSheetModel&&isActionSelected(item)}" |
148 | 149 | @click="actionClick(item)" |
|
196 | 197 | name: "vol-form", |
197 | 198 | data() { |
198 | 199 | return { |
| 200 | + showFilter:false, |
199 | 201 | searchText: '', //搜索的内容 |
200 | 202 | inFormFields: {}, |
201 | 203 | inFormOptions: [], |
202 | 204 | maxHeight: 400, |
| 205 | + popupHeight: 0, |
203 | 206 | pickerValue: '', |
204 | 207 | pickerModel: false, //日期组件 |
205 | 208 | pickerCurrentItem: {}, //当前选项 |
|
270 | 273 | var _this = this; |
271 | 274 | uni.getSystemInfo({ |
272 | 275 | success: function(res) { |
273 | | - _this.maxHeight = res.screenHeight * 0.75; |
| 276 | + _this.maxHeight = res.screenHeight * 0.85; |
274 | 277 | } |
275 | 278 | }); |
276 | 279 | }, |
|
321 | 324 | this.actionSheetSelectValues.push(value); |
322 | 325 | } |
323 | 326 | } |
324 | | -
|
| 327 | + this.showFilter = item.data.length > 15; |
| 328 | + let height = (item.data.length + 1+(this.showFilter?1:0)) * 50; |
| 329 | + this.popupHeight = height > this.maxHeight ? this.maxHeight : height; |
325 | 330 | this.actionSheetModel = true; |
326 | 331 | }, |
327 | 332 | actionClick(item) { |
|
796 | 801 |
|
797 | 802 | .f-form-group-content {} |
798 | 803 | } |
| 804 | +
|
799 | 805 | /deep/ .u-icon { |
800 | 806 | display: inline-flex; |
801 | 807 | } |
|
0 commit comments