@kengic/uni 0.3.2-beta.10
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/README.md +1 -0
- package/dist/index.css +1 -0
- package/dist/kengic-uni.js +5 -0
- package/dist/src/consts/i18n/en.d.ts +45 -0
- package/dist/src/consts/i18n/index.d.ts +90 -0
- package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/kg.util.d.ts +5 -0
- package/dist/uni-ui/index.ts +11 -0
- package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
- package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
- package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
- package/dist/uni-ui/uni-calendar/calendar.js +546 -0
- package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
- package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
- package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
- package/dist/uni-ui/uni-calendar/util.js +360 -0
- package/dist/uni-ui/uni-card/uni-card.vue +281 -0
- package/dist/uni-ui/uni-col/uni-col.vue +317 -0
- package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
- package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
- package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
- package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
- package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
- package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
- package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
- package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
- package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
- package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
- package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
- package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
- package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
- package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
- package/dist/uni-ui/uni-drawer/keypress.js +45 -0
- package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
- package/dist/uni-ui/uni-easyinput/common.js +56 -0
- package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
- package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
- package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
- package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
- package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
- package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
- package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
- package/dist/uni-ui/uni-file-picker/utils.js +109 -0
- package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
- package/dist/uni-ui/uni-forms/utils.js +293 -0
- package/dist/uni-ui/uni-forms/validate.js +486 -0
- package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
- package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
- package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
- package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
- package/dist/uni-ui/uni-group/uni-group.vue +134 -0
- package/dist/uni-ui/uni-icons/icons.js +1169 -0
- package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
- package/dist/uni-ui/uni-icons/uniicons.css +663 -0
- package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
- package/dist/uni-ui/uni-link/uni-link.vue +128 -0
- package/dist/uni-ui/uni-list/uni-list.vue +123 -0
- package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
- package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
- package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
- package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
- package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
- package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
- package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
- package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
- package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
- package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
- package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
- package/dist/uni-ui/uni-popup/keypress.js +45 -0
- package/dist/uni-ui/uni-popup/popup.js +23 -0
- package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
- package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
- package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
- package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
- package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
- package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
- package/dist/uni-ui/uni-row/uni-row.vue +190 -0
- package/dist/uni-ui/uni-scss/changelog.md +8 -0
- package/dist/uni-ui/uni-scss/index.scss +1 -0
- package/dist/uni-ui/uni-scss/package.json +82 -0
- package/dist/uni-ui/uni-scss/readme.md +4 -0
- package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
- package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
- package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
- package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
- package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
- package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
- package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
- package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
- package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
- package/dist/uni-ui/uni-scss/theme.scss +31 -0
- package/dist/uni-ui/uni-scss/variables.scss +62 -0
- package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
- package/dist/uni-ui/uni-section/uni-section.vue +167 -0
- package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
- package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
- package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
- package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
- package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
- package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
- package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
- package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
- package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
- package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
- package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
- package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
- package/dist/uni-ui/uni-table/uni-table.vue +455 -0
- package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
- package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
- package/dist/uni-ui/uni-td/uni-td.vue +90 -0
- package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
- package/dist/uni-ui/uni-th/uni-th.vue +285 -0
- package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
- package/dist/uni-ui/uni-title/uni-title.vue +171 -0
- package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
- package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
- package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
- package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
- package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
- package/package.json +90 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-searchbar">
|
|
3
|
+
<view :style="{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box"
|
|
4
|
+
@click="searchClick">
|
|
5
|
+
<view class="uni-searchbar__box-icon-search">
|
|
6
|
+
<slot name="searchIcon">
|
|
7
|
+
<uni-icons color="#c0c4cc" size="18" type="search" />
|
|
8
|
+
</slot>
|
|
9
|
+
</view>
|
|
10
|
+
<input v-if="show || searchVal" :focus="showSync" :disabled="readonly" :placeholder="placeholderText" :maxlength="maxlength"
|
|
11
|
+
class="uni-searchbar__box-search-input" confirm-type="search" type="text" v-model="searchVal"
|
|
12
|
+
@confirm="confirm" @blur="blur" @focus="emitFocus" />
|
|
13
|
+
<text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text>
|
|
14
|
+
<view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='') &&!readonly"
|
|
15
|
+
class="uni-searchbar__box-icon-clear" @click="clear">
|
|
16
|
+
<slot name="clearIcon">
|
|
17
|
+
<uni-icons color="#c0c4cc" size="20" type="clear" />
|
|
18
|
+
</slot>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
<text @click="cancel" class="uni-searchbar__cancel"
|
|
22
|
+
v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelTextI18n}}</text>
|
|
23
|
+
</view>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import {
|
|
28
|
+
initVueI18n
|
|
29
|
+
} from '@dcloudio/uni-i18n'
|
|
30
|
+
import messages from './i18n'
|
|
31
|
+
const {
|
|
32
|
+
t
|
|
33
|
+
} = initVueI18n(messages)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* SearchBar 搜索栏
|
|
37
|
+
* @description 搜索栏组件,通常用于搜索商品、文章等
|
|
38
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=866
|
|
39
|
+
* @property {Number} radius 搜索栏圆角
|
|
40
|
+
* @property {Number} maxlength 输入最大长度
|
|
41
|
+
* @property {String} placeholder 搜索栏Placeholder
|
|
42
|
+
* @property {String} clearButton = [always|auto|none] 是否显示清除按钮
|
|
43
|
+
* @value always 一直显示
|
|
44
|
+
* @value auto 输入框不为空时显示
|
|
45
|
+
* @value none 一直不显示
|
|
46
|
+
* @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
|
|
47
|
+
* @value always 一直显示
|
|
48
|
+
* @value auto 输入框不为空时显示
|
|
49
|
+
* @value none 一直不显示
|
|
50
|
+
* @property {String} cancelText 取消按钮的文字
|
|
51
|
+
* @property {String} bgColor 输入框背景颜色
|
|
52
|
+
* @property {Boolean} focus 是否自动聚焦
|
|
53
|
+
* @property {Boolean} readonly 组件只读,不能有任何操作,只做展示
|
|
54
|
+
* @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
|
|
55
|
+
* @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
|
|
56
|
+
* @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
|
|
57
|
+
* @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
|
|
58
|
+
* @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
name: "UniSearchBar",
|
|
63
|
+
emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'],
|
|
64
|
+
props: {
|
|
65
|
+
placeholder: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: ""
|
|
68
|
+
},
|
|
69
|
+
radius: {
|
|
70
|
+
type: [Number, String],
|
|
71
|
+
default: 5
|
|
72
|
+
},
|
|
73
|
+
clearButton: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "auto"
|
|
76
|
+
},
|
|
77
|
+
cancelButton: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "auto"
|
|
80
|
+
},
|
|
81
|
+
cancelText: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '取消'
|
|
84
|
+
},
|
|
85
|
+
bgColor: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "#F8F8F8"
|
|
88
|
+
},
|
|
89
|
+
maxlength: {
|
|
90
|
+
type: [Number, String],
|
|
91
|
+
default: 100
|
|
92
|
+
},
|
|
93
|
+
value: {
|
|
94
|
+
type: [Number, String],
|
|
95
|
+
default: ""
|
|
96
|
+
},
|
|
97
|
+
modelValue: {
|
|
98
|
+
type: [Number, String],
|
|
99
|
+
default: ""
|
|
100
|
+
},
|
|
101
|
+
focus: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: false
|
|
104
|
+
},
|
|
105
|
+
readonly: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
data() {
|
|
111
|
+
return {
|
|
112
|
+
show: false,
|
|
113
|
+
showSync: false,
|
|
114
|
+
searchVal: ''
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
computed: {
|
|
118
|
+
cancelTextI18n() {
|
|
119
|
+
return this.cancelText || t("uni-search-bar.cancel")
|
|
120
|
+
},
|
|
121
|
+
placeholderText() {
|
|
122
|
+
return this.placeholder || t("uni-search-bar.placeholder")
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
watch: {
|
|
126
|
+
// #ifndef VUE3
|
|
127
|
+
value: {
|
|
128
|
+
immediate: true,
|
|
129
|
+
handler(newVal) {
|
|
130
|
+
this.searchVal = newVal
|
|
131
|
+
if (newVal) {
|
|
132
|
+
this.show = true
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
// #endif
|
|
137
|
+
// #ifdef VUE3
|
|
138
|
+
modelValue: {
|
|
139
|
+
immediate: true,
|
|
140
|
+
handler(newVal) {
|
|
141
|
+
this.searchVal = newVal
|
|
142
|
+
if (newVal) {
|
|
143
|
+
this.show = true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
// #endif
|
|
148
|
+
focus: {
|
|
149
|
+
immediate: true,
|
|
150
|
+
handler(newVal) {
|
|
151
|
+
if (newVal) {
|
|
152
|
+
if(this.readonly) return
|
|
153
|
+
this.show = true;
|
|
154
|
+
this.$nextTick(() => {
|
|
155
|
+
this.showSync = true
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
searchVal(newVal, oldVal) {
|
|
161
|
+
this.$emit("input", newVal)
|
|
162
|
+
// #ifdef VUE3
|
|
163
|
+
this.$emit("update:modelValue", newVal)
|
|
164
|
+
// #endif
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
methods: {
|
|
168
|
+
searchClick() {
|
|
169
|
+
if(this.readonly) return
|
|
170
|
+
if (this.show) {
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
this.show = true;
|
|
174
|
+
this.$nextTick(() => {
|
|
175
|
+
this.showSync = true
|
|
176
|
+
})
|
|
177
|
+
},
|
|
178
|
+
clear() {
|
|
179
|
+
this.$emit("clear", {
|
|
180
|
+
value: this.searchVal
|
|
181
|
+
})
|
|
182
|
+
this.searchVal = ""
|
|
183
|
+
},
|
|
184
|
+
cancel() {
|
|
185
|
+
if(this.readonly) return
|
|
186
|
+
this.$emit("cancel", {
|
|
187
|
+
value: this.searchVal
|
|
188
|
+
});
|
|
189
|
+
this.searchVal = ""
|
|
190
|
+
this.show = false
|
|
191
|
+
this.showSync = false
|
|
192
|
+
// #ifndef APP-PLUS
|
|
193
|
+
uni.hideKeyboard()
|
|
194
|
+
// #endif
|
|
195
|
+
// #ifdef APP-PLUS
|
|
196
|
+
plus.key.hideSoftKeybord()
|
|
197
|
+
// #endif
|
|
198
|
+
},
|
|
199
|
+
confirm() {
|
|
200
|
+
// #ifndef APP-PLUS
|
|
201
|
+
uni.hideKeyboard();
|
|
202
|
+
// #endif
|
|
203
|
+
// #ifdef APP-PLUS
|
|
204
|
+
plus.key.hideSoftKeybord()
|
|
205
|
+
// #endif
|
|
206
|
+
this.$emit("confirm", {
|
|
207
|
+
value: this.searchVal
|
|
208
|
+
})
|
|
209
|
+
},
|
|
210
|
+
blur() {
|
|
211
|
+
// #ifndef APP-PLUS
|
|
212
|
+
uni.hideKeyboard();
|
|
213
|
+
// #endif
|
|
214
|
+
// #ifdef APP-PLUS
|
|
215
|
+
plus.key.hideSoftKeybord()
|
|
216
|
+
// #endif
|
|
217
|
+
this.$emit("blur", {
|
|
218
|
+
value: this.searchVal
|
|
219
|
+
})
|
|
220
|
+
},
|
|
221
|
+
emitFocus(e) {
|
|
222
|
+
this.$emit("focus", e.detail)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
</script>
|
|
227
|
+
|
|
228
|
+
<style lang="scss">
|
|
229
|
+
$uni-searchbar-height: 36px;
|
|
230
|
+
|
|
231
|
+
.uni-searchbar {
|
|
232
|
+
/* #ifndef APP-NVUE */
|
|
233
|
+
display: flex;
|
|
234
|
+
/* #endif */
|
|
235
|
+
flex-direction: row;
|
|
236
|
+
position: relative;
|
|
237
|
+
padding: 10px;
|
|
238
|
+
// background-color: #fff;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.uni-searchbar__box {
|
|
242
|
+
/* #ifndef APP-NVUE */
|
|
243
|
+
display: flex;
|
|
244
|
+
box-sizing: border-box;
|
|
245
|
+
/* #endif */
|
|
246
|
+
overflow: hidden;
|
|
247
|
+
position: relative;
|
|
248
|
+
flex: 1;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
flex-direction: row;
|
|
251
|
+
align-items: center;
|
|
252
|
+
height: $uni-searchbar-height;
|
|
253
|
+
padding: 5px 8px 5px 0px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.uni-searchbar__box-icon-search {
|
|
257
|
+
/* #ifndef APP-NVUE */
|
|
258
|
+
display: flex;
|
|
259
|
+
/* #endif */
|
|
260
|
+
flex-direction: row;
|
|
261
|
+
// width: 32px;
|
|
262
|
+
padding: 0 8px;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
align-items: center;
|
|
265
|
+
color: #B3B3B3;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.uni-searchbar__box-search-input {
|
|
269
|
+
flex: 1;
|
|
270
|
+
font-size: 14px;
|
|
271
|
+
color: #333;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.uni-searchbar__box-icon-clear {
|
|
275
|
+
align-items: center;
|
|
276
|
+
line-height: 24px;
|
|
277
|
+
padding-left: 8px;
|
|
278
|
+
/* #ifdef H5 */
|
|
279
|
+
cursor: pointer;
|
|
280
|
+
/* #endif */
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.uni-searchbar__text-placeholder {
|
|
284
|
+
font-size: 14px;
|
|
285
|
+
color: #B3B3B3;
|
|
286
|
+
margin-left: 5px;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.uni-searchbar__cancel {
|
|
290
|
+
padding-left: 10px;
|
|
291
|
+
line-height: $uni-searchbar-height;
|
|
292
|
+
font-size: 14px;
|
|
293
|
+
color: #333333;
|
|
294
|
+
/* #ifdef H5 */
|
|
295
|
+
cursor: pointer;
|
|
296
|
+
/* #endif */
|
|
297
|
+
}
|
|
298
|
+
</style>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-section">
|
|
3
|
+
<view class="uni-section-header" @click="onClick">
|
|
4
|
+
<view class="uni-section-header__decoration" v-if="type" :class="type" />
|
|
5
|
+
<slot v-else name="decoration"></slot>
|
|
6
|
+
|
|
7
|
+
<view class="uni-section-header__content">
|
|
8
|
+
<text :style="{'font-size':titleFontSize,'color':titleColor}" class="uni-section__content-title" :class="{'distraction':!subTitle}">{{ title }}</text>
|
|
9
|
+
<text v-if="subTitle" :style="{'font-size':subTitleFontSize,'color':subTitleColor}" class="uni-section-header__content-sub">{{ subTitle }}</text>
|
|
10
|
+
</view>
|
|
11
|
+
|
|
12
|
+
<view class="uni-section-header__slot-right">
|
|
13
|
+
<slot name="right"></slot>
|
|
14
|
+
</view>
|
|
15
|
+
</view>
|
|
16
|
+
|
|
17
|
+
<view class="uni-section-content" :style="{padding: _padding}">
|
|
18
|
+
<slot />
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Section 标题栏
|
|
27
|
+
* @description 标题栏
|
|
28
|
+
* @property {String} type = [line|circle|square] 标题装饰类型
|
|
29
|
+
* @value line 竖线
|
|
30
|
+
* @value circle 圆形
|
|
31
|
+
* @value square 正方形
|
|
32
|
+
* @property {String} title 主标题
|
|
33
|
+
* @property {String} titleFontSize 主标题字体大小
|
|
34
|
+
* @property {String} titleColor 主标题字体颜色
|
|
35
|
+
* @property {String} subTitle 副标题
|
|
36
|
+
* @property {String} subTitleFontSize 副标题字体大小
|
|
37
|
+
* @property {String} subTitleColor 副标题字体颜色
|
|
38
|
+
* @property {String} padding 默认插槽 padding
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: 'UniSection',
|
|
43
|
+
emits:['click'],
|
|
44
|
+
props: {
|
|
45
|
+
type: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ''
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true,
|
|
52
|
+
default: ''
|
|
53
|
+
},
|
|
54
|
+
titleFontSize: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '14px'
|
|
57
|
+
},
|
|
58
|
+
titleColor:{
|
|
59
|
+
type: String,
|
|
60
|
+
default: '#333'
|
|
61
|
+
},
|
|
62
|
+
subTitle: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: ''
|
|
65
|
+
},
|
|
66
|
+
subTitleFontSize: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '12px'
|
|
69
|
+
},
|
|
70
|
+
subTitleColor: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '#999'
|
|
73
|
+
},
|
|
74
|
+
padding: {
|
|
75
|
+
type: [Boolean, String],
|
|
76
|
+
default: false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
computed:{
|
|
80
|
+
_padding(){
|
|
81
|
+
if(typeof this.padding === 'string'){
|
|
82
|
+
return this.padding
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return this.padding?'10px':''
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
watch: {
|
|
89
|
+
title(newVal) {
|
|
90
|
+
if (uni.report && newVal !== '') {
|
|
91
|
+
uni.report('title', newVal)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
onClick() {
|
|
97
|
+
this.$emit('click')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
<style lang="scss" >
|
|
103
|
+
$uni-primary: #2979ff !default;
|
|
104
|
+
|
|
105
|
+
.uni-section {
|
|
106
|
+
background-color: #fff;
|
|
107
|
+
.uni-section-header {
|
|
108
|
+
position: relative;
|
|
109
|
+
/* #ifndef APP-NVUE */
|
|
110
|
+
display: flex;
|
|
111
|
+
/* #endif */
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
align-items: center;
|
|
114
|
+
padding: 12px 10px;
|
|
115
|
+
font-weight: normal;
|
|
116
|
+
|
|
117
|
+
&__decoration{
|
|
118
|
+
margin-right: 6px;
|
|
119
|
+
background-color: $uni-primary;
|
|
120
|
+
&.line {
|
|
121
|
+
width: 4px;
|
|
122
|
+
height: 12px;
|
|
123
|
+
border-radius: 10px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&.circle {
|
|
127
|
+
width: 8px;
|
|
128
|
+
height: 8px;
|
|
129
|
+
border-top-right-radius: 50px;
|
|
130
|
+
border-top-left-radius: 50px;
|
|
131
|
+
border-bottom-left-radius: 50px;
|
|
132
|
+
border-bottom-right-radius: 50px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&.square {
|
|
136
|
+
width: 8px;
|
|
137
|
+
height: 8px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&__content {
|
|
142
|
+
/* #ifndef APP-NVUE */
|
|
143
|
+
display: flex;
|
|
144
|
+
/* #endif */
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
flex: 1;
|
|
147
|
+
color: #333;
|
|
148
|
+
|
|
149
|
+
.distraction {
|
|
150
|
+
flex-direction: row;
|
|
151
|
+
align-items: center;
|
|
152
|
+
}
|
|
153
|
+
&-sub {
|
|
154
|
+
margin-top: 2px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&__slot-right{
|
|
159
|
+
font-size: 14px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.uni-section-content{
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="[styleType === 'text'?'segmented-control--text' : 'segmented-control--button' ]"
|
|
3
|
+
:style="{ borderColor: styleType === 'text' ? '' : activeColor }" class="segmented-control">
|
|
4
|
+
<view v-for="(item, index) in values" :class="[ styleType === 'text' ? '': 'segmented-control__item--button',
|
|
5
|
+
index === currentIndex&&styleType === 'button' ? 'segmented-control__item--button--active': '',
|
|
6
|
+
index === 0&&styleType === 'button' ? 'segmented-control__item--button--first': '',
|
|
7
|
+
index === values.length - 1&&styleType === 'button' ? 'segmented-control__item--button--last': '' ]" :key="index"
|
|
8
|
+
:style="{ backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',borderColor: index === currentIndex&&(styleType === 'text'||styleType === 'button')?activeColor:'#d9d9d9' }"
|
|
9
|
+
class="segmented-control__item" @click="_onClick(index)">
|
|
10
|
+
<view>
|
|
11
|
+
<text :style="{color:
|
|
12
|
+
index === currentIndex
|
|
13
|
+
? styleType === 'text'
|
|
14
|
+
? activeColor
|
|
15
|
+
: '#fff'
|
|
16
|
+
: styleType === 'text'
|
|
17
|
+
? '#000'
|
|
18
|
+
: activeColor}" class="segmented-control__text" :class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text': ''">{{ item }}</text>
|
|
19
|
+
</view>
|
|
20
|
+
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
/**
|
|
27
|
+
* SegmentedControl 分段器
|
|
28
|
+
* @description 用作不同视图的显示
|
|
29
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=54
|
|
30
|
+
* @property {Number} current 当前选中的tab索引值,从0计数
|
|
31
|
+
* @property {String} styleType = [button|text] 分段器样式类型
|
|
32
|
+
* @value button 按钮类型
|
|
33
|
+
* @value text 文字类型
|
|
34
|
+
* @property {String} activeColor 选中的标签背景色与边框颜色
|
|
35
|
+
* @property {Array} values 选项数组
|
|
36
|
+
* @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'UniSegmentedControl',
|
|
41
|
+
emits: ['clickItem'],
|
|
42
|
+
props: {
|
|
43
|
+
current: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 0
|
|
46
|
+
},
|
|
47
|
+
values: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default () {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
activeColor: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '#2979FF'
|
|
56
|
+
},
|
|
57
|
+
styleType: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'button'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
currentIndex: 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
current(val) {
|
|
69
|
+
if (val !== this.currentIndex) {
|
|
70
|
+
this.currentIndex = val
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
created() {
|
|
75
|
+
this.currentIndex = this.current
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
_onClick(index) {
|
|
79
|
+
if (this.currentIndex !== index) {
|
|
80
|
+
this.currentIndex = index
|
|
81
|
+
this.$emit('clickItem', {
|
|
82
|
+
currentIndex: index
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lang="scss" >
|
|
91
|
+
.segmented-control {
|
|
92
|
+
/* #ifndef APP-NVUE */
|
|
93
|
+
display: flex;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
/* #endif */
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
height: 36px;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
/* #ifdef H5 */
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
/* #endif */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.segmented-control__item {
|
|
105
|
+
/* #ifndef APP-NVUE */
|
|
106
|
+
display: inline-flex;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
/* #endif */
|
|
109
|
+
position: relative;
|
|
110
|
+
flex: 1;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.segmented-control__item--button {
|
|
116
|
+
border-style: solid;
|
|
117
|
+
border-top-width: 1px;
|
|
118
|
+
border-bottom-width: 1px;
|
|
119
|
+
border-right-width: 1px;
|
|
120
|
+
border-left-width: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.segmented-control__item--button--first {
|
|
124
|
+
border-left-width: 1px;
|
|
125
|
+
border-top-left-radius: 5px;
|
|
126
|
+
border-bottom-left-radius: 5px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.segmented-control__item--button--last {
|
|
130
|
+
border-top-right-radius: 5px;
|
|
131
|
+
border-bottom-right-radius: 5px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.segmented-control__item--text {
|
|
135
|
+
border-bottom-style: solid;
|
|
136
|
+
border-bottom-width: 2px;
|
|
137
|
+
padding: 6px 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.segmented-control__text {
|
|
141
|
+
font-size: 14px;
|
|
142
|
+
line-height: 20px;
|
|
143
|
+
text-align: center;
|
|
144
|
+
}
|
|
145
|
+
</style>
|