|
1 | 1 | <template>
|
2 |
| - <view class="uni-combox" nvue> |
| 2 | + <view class="uni-combox"> |
3 | 3 | <view v-if="label" class="uni-combox__label" :style="labelStyle">
|
4 | 4 | <text>{{label}}</text>
|
5 | 5 | </view>
|
6 | 6 | <view class="uni-combox__input-box">
|
7 | 7 | <input class="uni-combox__input" type="text" :placeholder="placeholder" v-model="inputVal" @input="onInput" @focus="onFocus" @blur="onBlur" />
|
8 | 8 | <uni-icons class="uni-combox__input-arrow" type="arrowdown" size="14" @click="toggleSelector"></uni-icons>
|
9 | 9 | <view class="uni-combox__selector" v-if="showSelector">
|
10 |
| - <view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0"> |
11 |
| - <text>{{emptyTips}}</text> |
12 |
| - </view> |
13 |
| - <view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" @click="onSelectorClick(index)"> |
14 |
| - <text>{{item}}</text> |
15 |
| - </view> |
| 10 | + <scroll-view scroll-y="true" class="uni-combox__selector-scroll"> |
| 11 | + <view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0"> |
| 12 | + <text>{{emptyTips}}</text> |
| 13 | + </view> |
| 14 | + <view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" @click="onSelectorClick(index)"> |
| 15 | + <text>{{item}}</text> |
| 16 | + </view> |
| 17 | + </scroll-view> |
16 | 18 | </view>
|
17 | 19 | </view>
|
18 | 20 | </view>
|
|
90 | 92 | this.showSelector = !this.showSelector
|
91 | 93 | },
|
92 | 94 | onFocus() {
|
93 |
| - setTimeout(() => { |
94 |
| - this.showSelector = true |
95 |
| - }) |
| 95 | + this.showSelector = true |
96 | 96 | },
|
97 | 97 | onBlur() {
|
98 | 98 | setTimeout(() => {
|
99 | 99 | this.showSelector = false
|
100 |
| - }) |
| 100 | + }, 50) |
101 | 101 | },
|
102 | 102 | onSelectorClick(index) {
|
103 | 103 | this.inputVal = this.filterCandidates[index]
|
|
127 | 127 |
|
128 | 128 | .uni-combox__label {
|
129 | 129 | font-size: 16px;
|
| 130 | + line-height: 22px; |
130 | 131 | padding-right: 10px;
|
131 | 132 | color: #999999;
|
132 | 133 | }
|
133 | 134 |
|
134 | 135 | .uni-combox__input-box {
|
| 136 | + position: relative; |
| 137 | + /* #ifndef APP-NVUE */ |
| 138 | + display: flex; |
| 139 | + /* #endif */ |
135 | 140 | flex: 1;
|
136 | 141 | flex-direction: row;
|
137 | 142 | align-items: center;
|
|
140 | 145 | .uni-combox__input {
|
141 | 146 | flex: 1;
|
142 | 147 | font-size: 16px;
|
| 148 | + height: 22px; |
| 149 | + line-height: 22px; |
143 | 150 | }
|
144 | 151 |
|
145 | 152 | .uni-combox__input-arrow {
|
146 | 153 | padding: 10px;
|
147 | 154 | }
|
148 | 155 |
|
149 | 156 | .uni-combox__selector {
|
150 |
| - flex-direction: column; |
| 157 | + box-sizing: border-box; |
151 | 158 | position: absolute;
|
152 | 159 | top: 42px;
|
153 | 160 | left: 0;
|
154 | 161 | width: 100%;
|
155 |
| - max-height: 200px; |
156 |
| - overflow-y: auto; |
157 |
| - padding: 10px; |
158 | 162 | background-color: #FFFFFF;
|
159 | 163 | border-radius: 6px;
|
160 | 164 | box-shadow: #DDDDDD 4px 4px 8px, #DDDDDD -4px -4px 8px;
|
161 | 165 | z-index: 2;
|
162 | 166 | }
|
163 | 167 |
|
| 168 | + .uni-combox__selector-scroll { |
| 169 | + max-height: 200px; |
| 170 | + box-sizing: border-box; |
| 171 | + } |
| 172 | +
|
164 | 173 | .uni-combox__selector::before {
|
165 | 174 | content: '';
|
166 | 175 | position: absolute;
|
|
183 | 192 | font-size: 14px;
|
184 | 193 | text-align: center;
|
185 | 194 | border-bottom: solid 1px #DDDDDD;
|
| 195 | + margin: 0px 10px; |
186 | 196 | }
|
187 | 197 |
|
188 | 198 | .uni-combox__selector-empty:last-child,
|
|
0 commit comments