stellar-ui-v2 1.35.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/css/common.scss +61 -0
- package/components/ste-animate/README.md +117 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/ste-animate.vue +200 -0
- package/components/ste-badge/README.md +171 -0
- package/components/ste-badge/ste-badge.vue +238 -0
- package/components/ste-barcode/README.md +36 -0
- package/components/ste-barcode/encode2.js +317 -0
- package/components/ste-barcode/ste-barcode.vue +213 -0
- package/components/ste-button/README.md +129 -0
- package/components/ste-button/ste-button.vue +345 -0
- package/components/ste-calendar/README.md +304 -0
- package/components/ste-calendar/self-date.js +119 -0
- package/components/ste-calendar/ste-calendar.vue +578 -0
- package/components/ste-checkbox/README.md +297 -0
- package/components/ste-checkbox/ste-checkbox.vue +305 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
- package/components/ste-code-input/README.md +67 -0
- package/components/ste-code-input/ste-code-input.vue +302 -0
- package/components/ste-date-picker/README.md +135 -0
- package/components/ste-date-picker/ste-date-picker.vue +407 -0
- package/components/ste-drag/README.md +103 -0
- package/components/ste-drag/ste-drag.vue +203 -0
- package/components/ste-dropdown-menu/README.md +358 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
- package/components/ste-icon/README.md +90 -0
- package/components/ste-icon/iconfont.css +8 -0
- package/components/ste-icon/ste-icon.vue +147 -0
- package/components/ste-image/README.md +154 -0
- package/components/ste-image/ste-image.vue +218 -0
- package/components/ste-index-item/ste-index-item.vue +96 -0
- package/components/ste-index-list/README.md +153 -0
- package/components/ste-index-list/ste-index-list.vue +128 -0
- package/components/ste-input/README.md +146 -0
- package/components/ste-input/ste-input.vue +480 -0
- package/components/ste-loading/README.md +81 -0
- package/components/ste-loading/ste-loading.vue +166 -0
- package/components/ste-media-preview/README.md +243 -0
- package/components/ste-media-preview/TouchScaleing.js +102 -0
- package/components/ste-media-preview/ste-media-preview.vue +267 -0
- package/components/ste-message-box/README.md +217 -0
- package/components/ste-message-box/ste-message-box.js +72 -0
- package/components/ste-message-box/ste-message-box.vue +380 -0
- package/components/ste-notice-bar/README.md +129 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
- package/components/ste-number-keyboard/README.md +246 -0
- package/components/ste-number-keyboard/keyboard.vue +140 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
- package/components/ste-picker/ste-picker.vue +258 -0
- package/components/ste-popup/README.md +148 -0
- package/components/ste-popup/ste-popup.vue +337 -0
- package/components/ste-price/README.md +129 -0
- package/components/ste-price/ste-price.vue +258 -0
- package/components/ste-progress/README.md +87 -0
- package/components/ste-progress/ste-progress.vue +200 -0
- package/components/ste-qrcode/README.md +50 -0
- package/components/ste-qrcode/ste-qrcode.vue +164 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/README.md +286 -0
- package/components/ste-radio/ste-radio.vue +293 -0
- package/components/ste-radio-group/ste-radio-group.vue +128 -0
- package/components/ste-rate/README.md +115 -0
- package/components/ste-rate/ste-rate.vue +202 -0
- package/components/ste-read-more/README.md +111 -0
- package/components/ste-read-more/ste-read-more.vue +133 -0
- package/components/ste-rich-text/README.md +31 -0
- package/components/ste-rich-text/ste-rich-text.vue +70 -0
- package/components/ste-scroll-to/README.md +68 -0
- package/components/ste-scroll-to/mixin.js +173 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
- package/components/ste-search/README.md +262 -0
- package/components/ste-search/ste-search.vue +547 -0
- package/components/ste-select/README.md +434 -0
- package/components/ste-select/datapager.vue +62 -0
- package/components/ste-select/datetime.vue +106 -0
- package/components/ste-select/defaultDate.js +142 -0
- package/components/ste-select/ste-select.vue +843 -0
- package/components/ste-signature/README.md +105 -0
- package/components/ste-signature/ste-signature.vue +220 -0
- package/components/ste-slider/README.md +165 -0
- package/components/ste-slider/ste-slider.vue +544 -0
- package/components/ste-step/ste-step.vue +264 -0
- package/components/ste-stepper/README.md +170 -0
- package/components/ste-stepper/ste-stepper.vue +373 -0
- package/components/ste-steps/README.md +132 -0
- package/components/ste-steps/ste-steps.vue +65 -0
- package/components/ste-sticky/README.md +52 -0
- package/components/ste-sticky/ste-sticky.vue +127 -0
- package/components/ste-swipe-action/README.md +197 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
- package/components/ste-swiper/README.md +173 -0
- package/components/ste-swiper/ste-swiper.vue +462 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/README.md +110 -0
- package/components/ste-switch/ste-switch.vue +144 -0
- package/components/ste-tab/ste-tab.vue +87 -0
- package/components/ste-table/README.md +785 -0
- package/components/ste-table/common.js +8 -0
- package/components/ste-table/ste-table.vue +666 -0
- package/components/ste-table/utils.js +20 -0
- package/components/ste-table-column/checkbox-icon.vue +65 -0
- package/components/ste-table-column/common.scss +65 -0
- package/components/ste-table-column/radio-icon.vue +110 -0
- package/components/ste-table-column/ste-table-column.vue +255 -0
- package/components/ste-table-column/sub-table.vue +116 -0
- package/components/ste-table-column/table-popover.vue +204 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/README.md +475 -0
- package/components/ste-tabs/props.js +212 -0
- package/components/ste-tabs/ste-tabs.vue +758 -0
- package/components/ste-text/README.md +66 -0
- package/components/ste-text/ste-text.vue +72 -0
- package/components/ste-toast/README.md +243 -0
- package/components/ste-toast/ste-toast.js +69 -0
- package/components/ste-toast/ste-toast.vue +231 -0
- package/components/ste-touch-swipe/README.md +104 -0
- package/components/ste-touch-swipe/TouchEvent.js +72 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
- package/components/ste-tour/README.md +194 -0
- package/components/ste-tour/ste-tour.vue +355 -0
- package/components/ste-tree/README.md +240 -0
- package/components/ste-tree/ste-tree.vue +350 -0
- package/components/ste-upload/README.md +276 -0
- package/components/ste-upload/ReadFile.js +229 -0
- package/components/ste-upload/ste-upload.vue +526 -0
- package/components/ste-video/README.md +60 -0
- package/components/ste-video/props.js +149 -0
- package/components/ste-video/ste-video.vue +647 -0
- package/config/color.js +22 -0
- package/index.js +2 -0
- package/package.json +19 -0
- package/utils/Color.js +66 -0
- package/utils/System.js +110 -0
- package/utils/dayjs.min.js +1 -0
- package/utils/mixin.js +67 -0
- package/utils/store.js +7 -0
- package/utils/utils.js +604 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-search-root" :style="[cmpStyleVar, cmpBackground, cmpRootPadding]" @click="onClick">
|
|
3
|
+
<view class="content">
|
|
4
|
+
<view class="icon-box">
|
|
5
|
+
<ste-icon code="" :color="prefixIconColor" size="44" />
|
|
6
|
+
</view>
|
|
7
|
+
<view class="input-box" v-if="!hiddenInput">
|
|
8
|
+
<ste-input
|
|
9
|
+
rootClass="ste-search-input"
|
|
10
|
+
placeholder-class="search-input-placeholder"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
:placeholder="cmpPlaceholder"
|
|
13
|
+
v-model="dataValue"
|
|
14
|
+
@input="onInput"
|
|
15
|
+
@confirm="onSearch"
|
|
16
|
+
@focus="onFocus"
|
|
17
|
+
@blur="onBlur"
|
|
18
|
+
@clear="onClear"
|
|
19
|
+
:focus="focus"
|
|
20
|
+
:clearable="clearable"
|
|
21
|
+
:fontColor="inputTextColor"
|
|
22
|
+
background="transparent"
|
|
23
|
+
:cursor="cursorNumber"
|
|
24
|
+
/>
|
|
25
|
+
<swiper
|
|
26
|
+
v-if="cmpShowSwitch"
|
|
27
|
+
class="placeholder-list"
|
|
28
|
+
:current="switchIndex"
|
|
29
|
+
:autoplay="autoplay"
|
|
30
|
+
:interval="interval"
|
|
31
|
+
circular
|
|
32
|
+
vertical
|
|
33
|
+
@change="onSwitchChange"
|
|
34
|
+
>
|
|
35
|
+
<swiper-item class="placeholder-item" v-for="(item, i) in hotWords" :key="i">
|
|
36
|
+
{{ item }}
|
|
37
|
+
</swiper-item>
|
|
38
|
+
</swiper>
|
|
39
|
+
</view>
|
|
40
|
+
<view v-if="!cmpHiddenLine" class="secrch-line" :class="disabled ? 'disabled' : ''" />
|
|
41
|
+
<view
|
|
42
|
+
v-if="!hiddenBtn"
|
|
43
|
+
class="search-button"
|
|
44
|
+
:class="disabled ? 'disabled' : ''"
|
|
45
|
+
:style="[cmpbtnBackground]"
|
|
46
|
+
@click="onSearch"
|
|
47
|
+
>
|
|
48
|
+
{{ btnText }}
|
|
49
|
+
</view>
|
|
50
|
+
</view>
|
|
51
|
+
<view class="nav-box" v-if="type === 'nav'" />
|
|
52
|
+
<!-- 输入建议 -->
|
|
53
|
+
<view
|
|
54
|
+
v-if="suggestionList.length > 0"
|
|
55
|
+
class="suggestions-box"
|
|
56
|
+
:class="showSuggestionsBox == null ? '' : showSuggestionsBox ? 'show' : 'hide'"
|
|
57
|
+
>
|
|
58
|
+
<scroll-view scroll-y class="scroll-box">
|
|
59
|
+
<view
|
|
60
|
+
class="item"
|
|
61
|
+
@click="handleSuggestionClick(item)"
|
|
62
|
+
v-for="(item, key) in suggestionList"
|
|
63
|
+
:key="key"
|
|
64
|
+
>
|
|
65
|
+
{{ item.label }}
|
|
66
|
+
</view>
|
|
67
|
+
</scroll-view>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
import utils from '../../utils/utils.js';
|
|
74
|
+
/**
|
|
75
|
+
* ste-search 搜索
|
|
76
|
+
* @description 搜索组件
|
|
77
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-search
|
|
78
|
+
* @property {String} type 组件类型
|
|
79
|
+
* @value default 正常搜索{String}
|
|
80
|
+
* @value nav 导航栏{String}
|
|
81
|
+
* @property {String} value 当前值(支持v-model双向绑定)
|
|
82
|
+
* @property {String} placeholder 占位提示符
|
|
83
|
+
* @property {String[]} hotWords 热词列表,默认值,[]
|
|
84
|
+
* @property {Number} interval 热词列表自动切换时间间隔,默认值,3000
|
|
85
|
+
* @property {Boolean} autoplay 热词列表自动切换,默认值,true
|
|
86
|
+
* @property {Boolean} disabled 是否禁用状态,默认值,false
|
|
87
|
+
* @property {Boolean} hiddenLine 是否隐藏分割线 ,默认值,false
|
|
88
|
+
* @property {Boolean} hiddenBtn 是否隐藏搜索按钮 ,默认值,false
|
|
89
|
+
* @property {String} btnText 搜索按钮文字 ,默认值 搜索
|
|
90
|
+
* @property {Boolean} hiddenInput 是否隐藏输入框,默认值,false
|
|
91
|
+
* @property {Boolean} clearable 是否可清空,默认值,true
|
|
92
|
+
* @property {Number} height 高度,单位rpx,默认值,64
|
|
93
|
+
* @property {Number} radius 圆角弧度,单位rpx,默认值,32
|
|
94
|
+
* @property {String} borderColor 边框颜色,默认值,#EEEEEE66
|
|
95
|
+
* @property {String} background 背景,默认值,#FFFFFF
|
|
96
|
+
* @property {String} prefixIconColor 前置图标颜色,默认值,#BBBBBB
|
|
97
|
+
* @property {String} placeholderColor 占位符文本颜色,默认值,#BBBBBB
|
|
98
|
+
* @property {String} inputTextColor 输入框文本颜色,默认值,#000000
|
|
99
|
+
* @property {String} clearIconColor 清除图标颜色,默认值,#BBBBBB
|
|
100
|
+
* @property {String} btnTextColor 搜索按钮文本颜色 ,默认值,#0090FF
|
|
101
|
+
* @property {String} btnBackground 搜索按钮背景
|
|
102
|
+
* @property {Boolean} focus 是否聚焦(双向绑定),默认值,false
|
|
103
|
+
* @event {Function} input 输入事件
|
|
104
|
+
* @event {Function} focus 聚焦焦点事件
|
|
105
|
+
* @event {Function} blur 失去焦点事件
|
|
106
|
+
* @event {Function} search 确定搜索时触发
|
|
107
|
+
* @event {Function} clear 点击清除按钮后触发
|
|
108
|
+
* @event {Function} click 点击事件
|
|
109
|
+
*/
|
|
110
|
+
export default {
|
|
111
|
+
group: '表单组件',
|
|
112
|
+
title: 'Search 搜索',
|
|
113
|
+
name: 'ste-search',
|
|
114
|
+
props: {
|
|
115
|
+
// 组件类型,"default":正常搜索,"nav":导航栏
|
|
116
|
+
type: {
|
|
117
|
+
type: [String, null],
|
|
118
|
+
default: () => 'default',
|
|
119
|
+
},
|
|
120
|
+
// 当前值(支持v-model双向绑定)
|
|
121
|
+
value: {
|
|
122
|
+
type: [String, null],
|
|
123
|
+
default: () => '',
|
|
124
|
+
},
|
|
125
|
+
// 占位提示符
|
|
126
|
+
placeholder: {
|
|
127
|
+
type: [String, null],
|
|
128
|
+
default: () => '',
|
|
129
|
+
},
|
|
130
|
+
// 热词列表
|
|
131
|
+
hotWords: {
|
|
132
|
+
type: [Array, null],
|
|
133
|
+
default: () => [],
|
|
134
|
+
},
|
|
135
|
+
// 热词列表自动切换时间间隔`
|
|
136
|
+
interval: {
|
|
137
|
+
type: [Number, null],
|
|
138
|
+
default: () => 3000,
|
|
139
|
+
},
|
|
140
|
+
// 热词列表是否自动切换
|
|
141
|
+
autoplay: {
|
|
142
|
+
type: [Boolean, null],
|
|
143
|
+
default: () => true,
|
|
144
|
+
},
|
|
145
|
+
// 是否禁用状态
|
|
146
|
+
disabled: {
|
|
147
|
+
type: [Boolean, null],
|
|
148
|
+
default: () => false,
|
|
149
|
+
},
|
|
150
|
+
// 是否隐藏分割线
|
|
151
|
+
hiddenLine: {
|
|
152
|
+
type: [Boolean, null],
|
|
153
|
+
default: () => false,
|
|
154
|
+
},
|
|
155
|
+
// 是否隐藏搜索按钮
|
|
156
|
+
hiddenBtn: {
|
|
157
|
+
type: [Boolean, null],
|
|
158
|
+
default: () => false,
|
|
159
|
+
},
|
|
160
|
+
// 搜索按钮文字
|
|
161
|
+
btnText: {
|
|
162
|
+
type: [String, null],
|
|
163
|
+
default: () => '搜索',
|
|
164
|
+
},
|
|
165
|
+
// 是否隐藏输入框
|
|
166
|
+
hiddenInput: {
|
|
167
|
+
type: [Boolean, null],
|
|
168
|
+
default: () => false,
|
|
169
|
+
},
|
|
170
|
+
// 是否可清空
|
|
171
|
+
clearable: {
|
|
172
|
+
type: [Boolean, null],
|
|
173
|
+
default: () => true,
|
|
174
|
+
},
|
|
175
|
+
// 边框颜色
|
|
176
|
+
borderColor: {
|
|
177
|
+
type: [String, null],
|
|
178
|
+
default: () => '#dddddd',
|
|
179
|
+
},
|
|
180
|
+
// 背景
|
|
181
|
+
background: {
|
|
182
|
+
type: [String, null],
|
|
183
|
+
default: () => '#ffffff',
|
|
184
|
+
},
|
|
185
|
+
// 前置图标颜色
|
|
186
|
+
prefixIconColor: {
|
|
187
|
+
type: [String, null],
|
|
188
|
+
default: () => '#bbbbbb',
|
|
189
|
+
},
|
|
190
|
+
// 占位符字体颜色
|
|
191
|
+
placeholderColor: {
|
|
192
|
+
type: [String, null],
|
|
193
|
+
default: () => '#bbbbbb',
|
|
194
|
+
},
|
|
195
|
+
// 输入框文字颜色
|
|
196
|
+
inputTextColor: {
|
|
197
|
+
type: [String, null],
|
|
198
|
+
default: () => '#000000',
|
|
199
|
+
},
|
|
200
|
+
// 清除图标颜色
|
|
201
|
+
clearIconColor: {
|
|
202
|
+
type: [String, null],
|
|
203
|
+
default: () => '#bbbbbb',
|
|
204
|
+
},
|
|
205
|
+
// 搜索按钮背景
|
|
206
|
+
btnBackground: {
|
|
207
|
+
type: [String, null],
|
|
208
|
+
},
|
|
209
|
+
// 搜索按钮文字颜色
|
|
210
|
+
btnTextColor: {
|
|
211
|
+
type: [String, null],
|
|
212
|
+
default: () => '#0090FF',
|
|
213
|
+
},
|
|
214
|
+
// 高度
|
|
215
|
+
height: {
|
|
216
|
+
type: [Number, null],
|
|
217
|
+
default: () => 64,
|
|
218
|
+
},
|
|
219
|
+
// 圆角弧度
|
|
220
|
+
radius: {
|
|
221
|
+
type: [Number, null],
|
|
222
|
+
default: () => 32,
|
|
223
|
+
},
|
|
224
|
+
// 聚焦
|
|
225
|
+
focus: {
|
|
226
|
+
type: [Boolean, null],
|
|
227
|
+
default: () => false,
|
|
228
|
+
},
|
|
229
|
+
suggestionList: {
|
|
230
|
+
type: [Array, null],
|
|
231
|
+
default: () => [],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
model: {
|
|
235
|
+
prop: 'value',
|
|
236
|
+
event: 'input',
|
|
237
|
+
},
|
|
238
|
+
data() {
|
|
239
|
+
return {
|
|
240
|
+
dataValue: '',
|
|
241
|
+
switchIndex: 0,
|
|
242
|
+
showSuggestionsBox: null,
|
|
243
|
+
cursorNumber: 0,
|
|
244
|
+
curSuggestion: '',
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
computed: {
|
|
248
|
+
cmpStyleVar() {
|
|
249
|
+
return {
|
|
250
|
+
'--search-root-height': utils.formatPx(this.height),
|
|
251
|
+
'--search-root-radius': utils.formatPx(this.radius),
|
|
252
|
+
'--search-btn-text-color': this.btnTextColor,
|
|
253
|
+
'--search-placeholder-color': this.placeholderColor,
|
|
254
|
+
'--search-input-color': this.inputTextColor,
|
|
255
|
+
'--search-border-color': this.borderColor,
|
|
256
|
+
};
|
|
257
|
+
},
|
|
258
|
+
cmpPlaceholder() {
|
|
259
|
+
return this.hotWords?.length ? '' : this.placeholder;
|
|
260
|
+
},
|
|
261
|
+
cmpHiddenLine() {
|
|
262
|
+
return this.hiddenLine || this.hiddenBtn;
|
|
263
|
+
},
|
|
264
|
+
cmpShowClear() {
|
|
265
|
+
return this.clearable && this.dataValue;
|
|
266
|
+
},
|
|
267
|
+
cmpShowSwitch() {
|
|
268
|
+
return this.hotWords?.length && !this.dataValue;
|
|
269
|
+
},
|
|
270
|
+
cmpBackground() {
|
|
271
|
+
return utils.bg2style(this.background);
|
|
272
|
+
},
|
|
273
|
+
cmpbtnBackground() {
|
|
274
|
+
return utils.bg2style(this.btnBackground);
|
|
275
|
+
},
|
|
276
|
+
cmpRootPadding() {
|
|
277
|
+
return this.hiddenBtn && this.hiddenInput ? {} : { padding: '0 8rpx 0 16rpx' };
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
watch: {
|
|
281
|
+
value: {
|
|
282
|
+
handler(val) {
|
|
283
|
+
this.dataValue = val;
|
|
284
|
+
},
|
|
285
|
+
immediate: true,
|
|
286
|
+
},
|
|
287
|
+
hotWords() {
|
|
288
|
+
this.switchIndex = 0;
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
methods: {
|
|
292
|
+
onInput() {
|
|
293
|
+
if (this.disabled) return;
|
|
294
|
+
this.$emit('input', this.dataValue);
|
|
295
|
+
},
|
|
296
|
+
onFocus() {
|
|
297
|
+
if (this.disabled) return;
|
|
298
|
+
this.$emit('focus', this.dataValue);
|
|
299
|
+
|
|
300
|
+
this.showSuggestionsBox = true;
|
|
301
|
+
},
|
|
302
|
+
onBlur() {
|
|
303
|
+
this.$emit('update:focus', false);
|
|
304
|
+
this.$emit('blur', this.dataValue);
|
|
305
|
+
},
|
|
306
|
+
onSearch() {
|
|
307
|
+
if (this.disabled) return;
|
|
308
|
+
let searchValue = this.dataValue;
|
|
309
|
+
if (!searchValue && this.hotWords.length) {
|
|
310
|
+
searchValue = this.hotWords[this.switchIndex];
|
|
311
|
+
}
|
|
312
|
+
this.$emit('search', searchValue);
|
|
313
|
+
},
|
|
314
|
+
onSwitchChange(v) {
|
|
315
|
+
this.switchIndex = v.detail.current;
|
|
316
|
+
},
|
|
317
|
+
onClick() {
|
|
318
|
+
if (this.disabled) return;
|
|
319
|
+
let searchValue = this.dataValue;
|
|
320
|
+
if (!searchValue && this.hotWords.length) {
|
|
321
|
+
searchValue = this.hotWords[this.switchIndex];
|
|
322
|
+
}
|
|
323
|
+
this.$emit('click', searchValue);
|
|
324
|
+
},
|
|
325
|
+
onClear() {
|
|
326
|
+
if (this.disabled) return;
|
|
327
|
+
this.dataValue = '';
|
|
328
|
+
this.$emit('input', this.dataValue);
|
|
329
|
+
this.$emit('clear');
|
|
330
|
+
},
|
|
331
|
+
handleSuggestionClick(item) {
|
|
332
|
+
this.dataValue = item.label;
|
|
333
|
+
this.$emit('input', item.label);
|
|
334
|
+
this.$emit('selectSuggestion', item);
|
|
335
|
+
this.showSuggestionsBox = false;
|
|
336
|
+
|
|
337
|
+
setTimeout(() => {
|
|
338
|
+
this.cursorNumber = item.label.length;
|
|
339
|
+
}, 50);
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
</script>
|
|
344
|
+
|
|
345
|
+
<style lang="scss" scoped>
|
|
346
|
+
.ste-search-root {
|
|
347
|
+
width: 100%;
|
|
348
|
+
height: var(--search-root-height);
|
|
349
|
+
background-color: #fff;
|
|
350
|
+
background-repeat: no-repeat;
|
|
351
|
+
background-size: 100% 100%;
|
|
352
|
+
border-radius: var(--search-root-radius);
|
|
353
|
+
border: 1rpx solid var(--search-border-color);
|
|
354
|
+
position: relative;
|
|
355
|
+
|
|
356
|
+
&,
|
|
357
|
+
view,
|
|
358
|
+
input {
|
|
359
|
+
box-sizing: border-box;
|
|
360
|
+
}
|
|
361
|
+
.content {
|
|
362
|
+
width: 100%;
|
|
363
|
+
height: 100%;
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: row;
|
|
366
|
+
align-items: center;
|
|
367
|
+
justify-content: center;
|
|
368
|
+
position: relative;
|
|
369
|
+
.icon-box {
|
|
370
|
+
width: 28rpx;
|
|
371
|
+
height: 28rpx;
|
|
372
|
+
flex-shrink: 0;
|
|
373
|
+
display: flex;
|
|
374
|
+
align-items: center;
|
|
375
|
+
justify-content: center;
|
|
376
|
+
|
|
377
|
+
.image {
|
|
378
|
+
width: 100%;
|
|
379
|
+
height: 100%;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
& + .input-box {
|
|
383
|
+
margin-left: 16rpx;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
.input-box {
|
|
387
|
+
position: relative;
|
|
388
|
+
flex: 1;
|
|
389
|
+
height: 100%;
|
|
390
|
+
/deep/ .search-input {
|
|
391
|
+
height: 100%;
|
|
392
|
+
|
|
393
|
+
font-size: 28rpx;
|
|
394
|
+
color: var(--search-input-color);
|
|
395
|
+
// #ifdef MP-ALIPAY
|
|
396
|
+
background-color: rgba(0, 0, 0, 0);
|
|
397
|
+
// #endif
|
|
398
|
+
|
|
399
|
+
.content {
|
|
400
|
+
padding: 0;
|
|
401
|
+
height: 100%;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
rch-input-placeholder {
|
|
405
|
+
color: var(--search-placeholder-color);
|
|
406
|
+
font-family: Alibaba PuHuiTi 2, Alibaba PuHuiTi 20;
|
|
407
|
+
font-weight: normal;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.placeholder-list {
|
|
412
|
+
width: 100%;
|
|
413
|
+
height: 100%;
|
|
414
|
+
pointer-events: none;
|
|
415
|
+
position: absolute;
|
|
416
|
+
top: 0;
|
|
417
|
+
left: 0;
|
|
418
|
+
.placeholder-item {
|
|
419
|
+
font-size: 28rpx;
|
|
420
|
+
color: var(--search-placeholder-color);
|
|
421
|
+
font-family: Alibaba PuHuiTi 2, Alibaba PuHuiTi 20;
|
|
422
|
+
font-weight: normal;
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
.clear-icon {
|
|
428
|
+
width: 48rpx;
|
|
429
|
+
height: 100%;
|
|
430
|
+
display: flex;
|
|
431
|
+
align-items: center;
|
|
432
|
+
justify-content: flex-end;
|
|
433
|
+
position: absolute;
|
|
434
|
+
right: 8rpx;
|
|
435
|
+
top: 50%;
|
|
436
|
+
z-index: 2;
|
|
437
|
+
transform: translateY(-50%);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
.secrch-line {
|
|
441
|
+
margin-left: 16rpx;
|
|
442
|
+
width: 2rpx;
|
|
443
|
+
flex-shrink: 0;
|
|
444
|
+
height: 24rpx;
|
|
445
|
+
background-color: var(--search-btn-text-color);
|
|
446
|
+
&.disabled {
|
|
447
|
+
background: #bbbbbb;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
.search-button {
|
|
451
|
+
padding: 0 16rpx;
|
|
452
|
+
height: 40rpx;
|
|
453
|
+
font-size: 28rpx;
|
|
454
|
+
line-height: 40rpx;
|
|
455
|
+
flex-shrink: 0;
|
|
456
|
+
text-align: center;
|
|
457
|
+
font-family: Alibaba PuHuiTi 2, Alibaba PuHuiTi 20;
|
|
458
|
+
font-weight: normal;
|
|
459
|
+
color: var(--search-btn-text-color);
|
|
460
|
+
border-radius: 20rpx;
|
|
461
|
+
background-repeat: no-repeat;
|
|
462
|
+
background-size: 100% 100%;
|
|
463
|
+
&.disabled {
|
|
464
|
+
color: #bbbbbb;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
.nav-box {
|
|
469
|
+
position: absolute;
|
|
470
|
+
width: 100%;
|
|
471
|
+
height: 100%;
|
|
472
|
+
top: 0;
|
|
473
|
+
left: 0;
|
|
474
|
+
z-index: 2;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.suggestions-box {
|
|
478
|
+
z-index: 999;
|
|
479
|
+
position: absolute;
|
|
480
|
+
left: 0;
|
|
481
|
+
top: 100%;
|
|
482
|
+
overflow-y: hidden;
|
|
483
|
+
opacity: 0;
|
|
484
|
+
max-height: 0;
|
|
485
|
+
|
|
486
|
+
margin: 20rpx 0;
|
|
487
|
+
width: 100%;
|
|
488
|
+
|
|
489
|
+
background-color: #ffffff;
|
|
490
|
+
box-shadow: 0 4rpx 24rpx 0 rgba(0, 0, 0, 0.1);
|
|
491
|
+
border-radius: 8rpx;
|
|
492
|
+
padding: 16rpx 0;
|
|
493
|
+
|
|
494
|
+
.scroll-box {
|
|
495
|
+
width: 100%;
|
|
496
|
+
max-height: calc(400rpx - 32rpx);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.item {
|
|
500
|
+
padding-left: 16rpx;
|
|
501
|
+
width: 100%;
|
|
502
|
+
height: 60rpx;
|
|
503
|
+
display: flex;
|
|
504
|
+
align-items: center;
|
|
505
|
+
font-size: 28rpx;
|
|
506
|
+
color: #bbbbbb;
|
|
507
|
+
|
|
508
|
+
&:focus {
|
|
509
|
+
background-color: red;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
&.show {
|
|
514
|
+
opacity: 1;
|
|
515
|
+
max-height: 400rpx;
|
|
516
|
+
animation: suggestions-show 0.2s ease-out;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
&.hide {
|
|
520
|
+
animation: suggestions-hide 0.2s ease-out;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
@keyframes suggestions-show {
|
|
525
|
+
0% {
|
|
526
|
+
opacity: 0;
|
|
527
|
+
max-height: 0;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
100% {
|
|
531
|
+
opacity: 1;
|
|
532
|
+
max-height: 400rpx;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
@keyframes suggestions-hide {
|
|
536
|
+
0% {
|
|
537
|
+
opacity: 1;
|
|
538
|
+
max-height: 400rpx;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
100% {
|
|
542
|
+
opacity: 0;
|
|
543
|
+
max-height: 0;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
</style>
|