@zfqh/uview-x 0.0.0-stage → 0.0.2
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +127 -3
- package/components/uv-badge/props.ts +83 -0
- package/components/uv-badge/uv-badge.vue +186 -0
- package/components/uv-button/props.ts +148 -0
- package/components/uv-button/uv-button.vue +565 -0
- package/components/uv-checkbox/props.ts +83 -0
- package/components/uv-checkbox/uv-checkbox.vue +403 -0
- package/components/uv-checkbox-group/props.ts +97 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +163 -0
- package/components/uv-code/props.ts +48 -0
- package/components/uv-code/uv-code.vue +156 -0
- package/components/uv-dialog/props.ts +56 -0
- package/components/uv-dialog/uv-dialog.vue +492 -0
- package/components/uv-form/props.ts +59 -0
- package/components/uv-form/uv-form.vue +256 -0
- package/components/uv-form/valid.ts +1344 -0
- package/components/uv-form-item/props.ts +62 -0
- package/components/uv-form-item/uv-form-item.vue +335 -0
- package/components/uv-icon/icons.ts +161 -0
- package/components/uv-icon/props.ts +91 -0
- package/components/uv-icon/uv-icon.vue +208 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-input/props.ts +185 -0
- package/components/uv-input/uv-input.vue +431 -0
- package/components/uv-line/props.ts +42 -0
- package/components/uv-line/uv-line.vue +75 -0
- package/components/uv-line-progress/props.ts +43 -0
- package/components/uv-line-progress/uv-line-progress.vue +166 -0
- package/components/uv-loading-icon/props.ts +78 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +226 -0
- package/components/uv-overlay/props.ts +38 -0
- package/components/uv-overlay/uv-overlay.vue +120 -0
- package/components/uv-popup/props.ts +101 -0
- package/components/uv-popup/uv-popup.vue +371 -0
- package/components/uv-safe-bottom/props.ts +18 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +120 -0
- package/components/uv-status-bar/props.ts +22 -0
- package/components/uv-status-bar/uv-status-bar.vue +121 -0
- package/components/uv-tabs/props.ts +84 -0
- package/components/uv-tabs/uv-tabs.vue +432 -0
- package/components/uv-transition/props.ts +38 -0
- package/components/uv-transition/uv-transition.vue +170 -0
- package/hooks/index.ts +5 -0
- package/hooks/useDebounce.ts +35 -0
- package/hooks/useI18n.ts +95 -0
- package/hooks/useThrottle.ts +38 -0
- package/index.ts +23 -0
- package/libs/dayjs/index.ts +217 -0
- package/libs/index.ts +4 -0
- package/libs/luch-request/adapters/index.ts +133 -0
- package/libs/luch-request/core/InterceptorManager.ts +52 -0
- package/libs/luch-request/core/Request.ts +202 -0
- package/libs/luch-request/core/buildFullPath.ts +21 -0
- package/libs/luch-request/core/defaults.ts +34 -0
- package/libs/luch-request/core/dispatchRequest.ts +7 -0
- package/libs/luch-request/core/mergeConfig.ts +127 -0
- package/libs/luch-request/core/settle.ts +17 -0
- package/libs/luch-request/helpers/buildURL.ts +65 -0
- package/libs/luch-request/helpers/combineURLs.ts +15 -0
- package/libs/luch-request/helpers/isAbsoluteURL.ts +15 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.ts +3 -0
- package/libs/luch-request/utils/clone.ts +265 -0
- package/libs/luch-request/utils.ts +136 -0
- package/locales/en.ts +78 -0
- package/locales/index.ts +169 -0
- package/locales/zh-Hans.ts +78 -0
- package/package.json +42 -4
- package/styles/color.scss +33 -0
- package/styles/common.scss +134 -0
- package/styles/components.scss +19 -0
- package/styles/index.scss +7 -0
- package/styles/theme.scss +44 -0
- package/styles/var.module.scss +32 -0
- package/styles/vue.scss +39 -0
- package/theme.scss +2 -0
- package/types/index.d.ts +66 -0
- package/utils/colorGradient.ts +139 -0
- package/utils/compat.ts +165 -0
- package/utils/compress.ts +34 -0
- package/utils/config.ts +95 -0
- package/utils/debounce.ts +7 -0
- package/utils/digit.ts +157 -0
- package/utils/function.ts +771 -0
- package/utils/http.ts +5 -0
- package/utils/index.ts +57 -0
- package/utils/locale.ts +296 -0
- package/utils/platform.ts +71 -0
- package/utils/route.ts +142 -0
- package/utils/test.ts +256 -0
- package/utils/throttle.ts +7 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-button-wrapper" :style="[btnWrapperStyle]">
|
|
3
|
+
<view
|
|
4
|
+
v-if="p.disabled || p.loading"
|
|
5
|
+
class="uv-button-wrapper--dis"
|
|
6
|
+
@click="disabledHandler"
|
|
7
|
+
></view>
|
|
8
|
+
|
|
9
|
+
<!-- #ifdef MP -->
|
|
10
|
+
<button
|
|
11
|
+
:hover-start-time="Number(p.hoverStartTime)"
|
|
12
|
+
:hover-stay-time="Number(p.hoverStayTime)"
|
|
13
|
+
:form-type="p.formType"
|
|
14
|
+
:open-type="p.openType"
|
|
15
|
+
:app-parameter="p.appParameter"
|
|
16
|
+
:hover-stop-propagation="p.hoverStopPropagation"
|
|
17
|
+
:send-message-title="p.sendMessageTitle"
|
|
18
|
+
:send-message-path="p.sendMessagePath"
|
|
19
|
+
:lang="p.lang"
|
|
20
|
+
:data-name="p.dataName"
|
|
21
|
+
:session-from="p.sessionFrom"
|
|
22
|
+
:send-message-img="p.sendMessageImg"
|
|
23
|
+
:show-message-card="p.showMessageCard"
|
|
24
|
+
:hover-class="hoverClass"
|
|
25
|
+
class="uv-button uv-reset-button"
|
|
26
|
+
:class="[bemClass, p.customClass, p.color ? 'uv-button--custom-color' : '']"
|
|
27
|
+
:style="[baseColor, radiusStyle, $uv.addStyle(p.customStyle)]"
|
|
28
|
+
@click="clickHandler"
|
|
29
|
+
@getphonenumber="onGetPhoneNumber"
|
|
30
|
+
@getuserinfo="onGetUserInfo"
|
|
31
|
+
@error="onError"
|
|
32
|
+
@opensetting="onOpenSetting"
|
|
33
|
+
@launchapp="onLaunchApp"
|
|
34
|
+
@contact="onContact"
|
|
35
|
+
@chooseavatar="onChooseavatar"
|
|
36
|
+
@agreeprivacyauthorization="onAgreeprivacyauthorization"
|
|
37
|
+
@addgroupapp="onAddgroupapp"
|
|
38
|
+
@chooseaddress="onChooseaddress"
|
|
39
|
+
@subscribe="onSubscribe"
|
|
40
|
+
@login="onLogin"
|
|
41
|
+
@im="onIm"
|
|
42
|
+
>
|
|
43
|
+
<template v-if="p.loading">
|
|
44
|
+
<uv-loading-icon
|
|
45
|
+
:mode="p.loadingMode"
|
|
46
|
+
:size="Number(p.loadingSize) * 1.15"
|
|
47
|
+
:color="loadingColor"
|
|
48
|
+
></uv-loading-icon>
|
|
49
|
+
<text
|
|
50
|
+
class="uv-button__loading-text"
|
|
51
|
+
:style="[{ fontSize: textSize + 'px', color: textColorCom }, $uv.addStyle(p.customTextStyle)]"
|
|
52
|
+
>{{ p.loadingText || p.text }}</text>
|
|
53
|
+
</template>
|
|
54
|
+
<template v-else>
|
|
55
|
+
<uv-icon
|
|
56
|
+
v-if="p.icon"
|
|
57
|
+
:name="p.icon"
|
|
58
|
+
:color="iconColorCom"
|
|
59
|
+
:size="getIconSize"
|
|
60
|
+
></uv-icon>
|
|
61
|
+
<slot>
|
|
62
|
+
<text
|
|
63
|
+
class="uv-button__text"
|
|
64
|
+
:style="[textStyleCom, $uv.addStyle(p.customTextStyle)]"
|
|
65
|
+
>{{ p.text }}</text>
|
|
66
|
+
</slot>
|
|
67
|
+
<slot name="suffix"></slot>
|
|
68
|
+
</template>
|
|
69
|
+
</button>
|
|
70
|
+
<!-- #endif -->
|
|
71
|
+
|
|
72
|
+
<!-- #ifndef MP -->
|
|
73
|
+
<view
|
|
74
|
+
:hover-start-time="Number(p.hoverStartTime)"
|
|
75
|
+
:hover-stay-time="Number(p.hoverStayTime)"
|
|
76
|
+
:hover-class="hoverClass"
|
|
77
|
+
class="uv-button uv-reset-button"
|
|
78
|
+
:class="[bemClass, p.customClass, p.color ? 'uv-button--custom-color' : '']"
|
|
79
|
+
:style="[baseColor, radiusStyle, $uv.addStyle(p.customStyle)]"
|
|
80
|
+
@click="clickHandler"
|
|
81
|
+
>
|
|
82
|
+
<template v-if="p.loading">
|
|
83
|
+
<uv-loading-icon
|
|
84
|
+
:mode="p.loadingMode"
|
|
85
|
+
:size="Number(p.loadingSize) * 1.15"
|
|
86
|
+
:color="loadingColor"
|
|
87
|
+
></uv-loading-icon>
|
|
88
|
+
<text
|
|
89
|
+
class="uv-button__loading-text"
|
|
90
|
+
:style="[{ fontSize: textSize + 'px', color: textColorCom }, $uv.addStyle(p.customTextStyle)]"
|
|
91
|
+
>{{ p.loadingText || p.text }}</text>
|
|
92
|
+
</template>
|
|
93
|
+
<template v-else>
|
|
94
|
+
<uv-icon
|
|
95
|
+
v-if="p.icon"
|
|
96
|
+
:name="p.icon"
|
|
97
|
+
:color="iconColorCom"
|
|
98
|
+
:size="getIconSize"
|
|
99
|
+
></uv-icon>
|
|
100
|
+
<slot>
|
|
101
|
+
<text
|
|
102
|
+
class="uv-button__text"
|
|
103
|
+
:style="[textStyleCom, $uv.addStyle(p.customTextStyle)]"
|
|
104
|
+
>{{ p.text }}</text>
|
|
105
|
+
</slot>
|
|
106
|
+
<slot name="suffix"></slot>
|
|
107
|
+
</template>
|
|
108
|
+
</view>
|
|
109
|
+
<!-- #endif -->
|
|
110
|
+
</view>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { computed } from 'vue'
|
|
115
|
+
import { $uv } from '../../utils'
|
|
116
|
+
import props from './props'
|
|
117
|
+
import { useThrottle } from '../../hooks'
|
|
118
|
+
import { createBem } from '../../utils/compat'
|
|
119
|
+
|
|
120
|
+
const throttle = useThrottle()
|
|
121
|
+
|
|
122
|
+
defineOptions({
|
|
123
|
+
name: 'uv-button',
|
|
124
|
+
// #ifdef UNI-APP-X
|
|
125
|
+
styleIsolation: 'app-and-page',
|
|
126
|
+
// #endif
|
|
127
|
+
virtualHost: true,
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* button 按钮
|
|
132
|
+
* @description Button 按钮
|
|
133
|
+
* @tutorial https://www.uvui.cn/components/button.html
|
|
134
|
+
* @property {Boolean} hairline 是否显示按钮的细边框
|
|
135
|
+
* @property {String} type 按钮预置样式
|
|
136
|
+
* @property {String} size 按钮尺寸
|
|
137
|
+
* @property {String} shape 按钮形状
|
|
138
|
+
* @property {String | Number} radius 按钮圆角
|
|
139
|
+
* @property {Boolean} plain 是否镂空
|
|
140
|
+
* @property {Boolean} light 是否浅色按钮(背景取主题色 light,与 plain 冲突时 plain 优先)
|
|
141
|
+
* @property {Boolean} disabled 是否禁用
|
|
142
|
+
* @property {Boolean} loading 是否加载中
|
|
143
|
+
* @property {String | Number} loadingText 加载中提示文字
|
|
144
|
+
* @property {String} loadingMode 加载状态图标类型
|
|
145
|
+
* @property {String | Number} loadingSize 加载图标大小
|
|
146
|
+
* @property {String} openType 开放能力(MP)
|
|
147
|
+
* @property {String} formType 表单提交/重置(MP)
|
|
148
|
+
* @property {String} icon 按钮图标
|
|
149
|
+
* @property {String} iconColor 按钮图标颜色
|
|
150
|
+
* @property {String} color 按钮颜色,支持 linear-gradient
|
|
151
|
+
* @property {Object} customStyle 外部样式
|
|
152
|
+
* @property {Object} customTextStyle 文字样式
|
|
153
|
+
* @event {Function} click 点击按钮
|
|
154
|
+
* @event {Function} disable 禁用状态点击
|
|
155
|
+
* @event {Function} getphonenumber / getuserinfo / error / opensetting / launchapp 等 MP 开放能力事件
|
|
156
|
+
* @example <uv-button type="primary">提交</uv-button>
|
|
157
|
+
*/
|
|
158
|
+
const p = defineProps(props)
|
|
159
|
+
|
|
160
|
+
const emit = defineEmits([
|
|
161
|
+
'click',
|
|
162
|
+
'disable',
|
|
163
|
+
'getphonenumber',
|
|
164
|
+
'getuserinfo',
|
|
165
|
+
'error',
|
|
166
|
+
'opensetting',
|
|
167
|
+
'launchapp',
|
|
168
|
+
'contact',
|
|
169
|
+
'chooseavatar',
|
|
170
|
+
'agreeprivacyauthorization',
|
|
171
|
+
'addgroupapp',
|
|
172
|
+
'chooseaddress',
|
|
173
|
+
'subscribe',
|
|
174
|
+
'login',
|
|
175
|
+
'im'
|
|
176
|
+
])
|
|
177
|
+
|
|
178
|
+
const getValue = (key: string) => {
|
|
179
|
+
// plain 与 light 冲突时 plain 优先:light 类名不参与拼接
|
|
180
|
+
if (key === 'light') return p.light && !p.plain
|
|
181
|
+
return (p as any)[key]
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const bemClass = computed(() => {
|
|
185
|
+
const fixed = p.color ? ['shape', 'size'] : ['type', 'shape', 'size']
|
|
186
|
+
return createBem('button', getValue, fixed, ['disabled', 'plain', 'hairline', 'light'])
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
const lightColorCom = computed(() => {
|
|
190
|
+
if (p.plain || !p.light || p.color) return ''
|
|
191
|
+
return typeTextColors[p.type] || typeTextColors.info
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
const loadingColor = computed(() => {
|
|
195
|
+
if (lightColorCom.value) return lightColorCom.value
|
|
196
|
+
if (p.plain) return p.color ? p.color : '#3c9cff'
|
|
197
|
+
if (p.type === 'info') return '#c9c9c9'
|
|
198
|
+
return 'rgb(200, 200, 200)'
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
const iconColorCom = computed(() => {
|
|
202
|
+
// 与上游一致:iconColor 默认 '#000000',设置后优先使用
|
|
203
|
+
// light 浅色按钮默认图标跟随主题色(按下仅整体透明度变化)
|
|
204
|
+
if (lightColorCom.value && p.iconColor === '#000000') return lightColorCom.value
|
|
205
|
+
if (p.iconColor) return p.iconColor
|
|
206
|
+
if (p.plain) return p.color ? p.color : p.type
|
|
207
|
+
return p.type === 'info' ? '#000000' : '#ffffff'
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
// uv-ui 主题色(与 styles/color.scss 一致),用于 plain/light 态文字颜色
|
|
211
|
+
const typeTextColors: Record<string, string> = {
|
|
212
|
+
info: '#909399',
|
|
213
|
+
primary: '#3c9cff',
|
|
214
|
+
success: '#5ac725',
|
|
215
|
+
warning: '#f9ae3d',
|
|
216
|
+
error: '#f56c6c'
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// light 按钮:由 hover-class 挂 uv-button--light-active(整体透明度),
|
|
220
|
+
// 保证 H5/MP/App/nvue 都使用原生 hover-class 机制(App x 不支持 CSS 伪类/JS 触摸状态)。
|
|
221
|
+
const isLightButton = computed(() => p.light && !p.plain && !p.color)
|
|
222
|
+
|
|
223
|
+
// 主题类型(unknown type 回退 info),用于生成单类名形式的点击态 class,
|
|
224
|
+
// 避免 App x 对复合 class 选择器匹配不稳定。
|
|
225
|
+
const themeType = computed(() =>
|
|
226
|
+
['info', 'primary', 'success', 'warning', 'error'].includes(p.type) ? p.type : 'info'
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
const textColorCom = computed(() => {
|
|
230
|
+
if (p.color) return p.plain ? p.color : '#ffffff'
|
|
231
|
+
// 镂空/浅色态文字使用主题色(与上游 .uv-button--plain.uv-button--<type> 一致)
|
|
232
|
+
if (p.plain) return typeTextColors[p.type] || typeTextColors.info
|
|
233
|
+
if (lightColorCom.value) return lightColorCom.value
|
|
234
|
+
return p.type === 'info' ? '#323233' : '#ffffff'
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
// 点击态类名(全部为单 class,H5/MP/App x/nvue 均可匹配):
|
|
238
|
+
// - 普通按钮:uv-button--active-<type>(背景 dark)
|
|
239
|
+
// - plain:uv-button--active-plain-<type>(背景 light)
|
|
240
|
+
// - light:uv-button--light-active(opacity 0.7)
|
|
241
|
+
// - 自定义 color:uv-button--active-custom(opacity 0.85)
|
|
242
|
+
const hoverClass = computed(() => {
|
|
243
|
+
if (p.disabled || p.loading) return 'none'
|
|
244
|
+
if (isLightButton.value) return 'uv-button--light-active'
|
|
245
|
+
if (p.color) return 'uv-button--active-custom'
|
|
246
|
+
if (p.plain) return `uv-button--active-plain-${themeType.value}`
|
|
247
|
+
return `uv-button--active-${themeType.value}`
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
const baseColor = computed(() => {
|
|
251
|
+
const style: any = {}
|
|
252
|
+
if (!p.color) return style
|
|
253
|
+
style.color = p.plain ? p.color : 'white'
|
|
254
|
+
if (!p.plain) style.backgroundColor = p.color
|
|
255
|
+
if (p.color.indexOf('gradient') !== -1) {
|
|
256
|
+
style.borderTopWidth = 0
|
|
257
|
+
style.borderRightWidth = 0
|
|
258
|
+
style.borderBottomWidth = 0
|
|
259
|
+
style.borderLeftWidth = 0
|
|
260
|
+
// #ifdef APP-NVUE
|
|
261
|
+
if (!p.plain) style.backgroundColor = '#3c9cff'
|
|
262
|
+
// #endif
|
|
263
|
+
// #ifndef APP-NVUE
|
|
264
|
+
if (!p.plain) style.backgroundImage = p.color
|
|
265
|
+
// #endif
|
|
266
|
+
} else {
|
|
267
|
+
style.borderColor = p.color
|
|
268
|
+
style.borderWidth = '1px'
|
|
269
|
+
style.borderStyle = 'solid'
|
|
270
|
+
}
|
|
271
|
+
return style
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
const radiusStyle = computed(() => {
|
|
275
|
+
const style: any = {}
|
|
276
|
+
if (p.shape === 'square' && p.radius !== null && p.radius !== '') {
|
|
277
|
+
const value = $uv.addUnit(p.radius)
|
|
278
|
+
style.borderTopLeftRadius = value
|
|
279
|
+
style.borderTopRightRadius = value
|
|
280
|
+
style.borderBottomLeftRadius = value
|
|
281
|
+
style.borderBottomRightRadius = value
|
|
282
|
+
}
|
|
283
|
+
return style
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
const textSize = computed(() => {
|
|
287
|
+
let fontSize = 14
|
|
288
|
+
if (p.size === 'large') fontSize = 16
|
|
289
|
+
if (p.size === 'normal') fontSize = 14
|
|
290
|
+
if (p.size === 'small') fontSize = 12
|
|
291
|
+
if (p.size === 'mini') fontSize = 10
|
|
292
|
+
return fontSize
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
const getIconSize = computed(() => {
|
|
296
|
+
const size = p.iconSize ? p.iconSize : textSize.value * 1.35
|
|
297
|
+
return $uv.addUnit(size)
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
// 文本样式:颜色显式下发(nvue 的 text 不继承父节点颜色),
|
|
301
|
+
// 有图标且文字非空时保留 2px 间距(与上游 nvue 分支及 H5 demo 实际渲染一致)
|
|
302
|
+
const textStyleCom = computed(() => {
|
|
303
|
+
const style: any = {
|
|
304
|
+
fontSize: textSize.value + 'px',
|
|
305
|
+
color: textColorCom.value
|
|
306
|
+
}
|
|
307
|
+
if (p.icon && String(p.text) !== '') style.marginLeft = '2px'
|
|
308
|
+
return style
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
const btnWrapperStyle = computed(() => {
|
|
312
|
+
const style: any = {}
|
|
313
|
+
const customStyle = $uv.addStyle(p.customStyle)
|
|
314
|
+
if (customStyle && customStyle.width) style.width = customStyle.width
|
|
315
|
+
return style
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
const clickHandler = () => {
|
|
319
|
+
if (!p.disabled && !p.loading) {
|
|
320
|
+
throttle(() => {
|
|
321
|
+
emit('click')
|
|
322
|
+
}, Number(p.throttleTime))
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const disabledHandler = () => {
|
|
327
|
+
if (p.disabled && !p.loading) {
|
|
328
|
+
throttle(() => {
|
|
329
|
+
emit('disable')
|
|
330
|
+
}, Number(p.throttleTime))
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const emitDetail = (name: string, event: any) => {
|
|
335
|
+
emit(name, event?.detail)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const onGetPhoneNumber = (event: any) => emitDetail('getphonenumber', event)
|
|
339
|
+
const onGetUserInfo = (event: any) => emitDetail('getuserinfo', event)
|
|
340
|
+
const onError = (event: any) => emitDetail('error', event)
|
|
341
|
+
const onOpenSetting = (event: any) => emitDetail('opensetting', event)
|
|
342
|
+
const onLaunchApp = (event: any) => emitDetail('launchapp', event)
|
|
343
|
+
const onContact = (event: any) => emitDetail('contact', event)
|
|
344
|
+
const onChooseavatar = (event: any) => emitDetail('chooseavatar', event)
|
|
345
|
+
const onAgreeprivacyauthorization = (event: any) => emitDetail('agreeprivacyauthorization', event)
|
|
346
|
+
const onAddgroupapp = (event: any) => emitDetail('addgroupapp', event)
|
|
347
|
+
const onChooseaddress = (event: any) => emitDetail('chooseaddress', event)
|
|
348
|
+
const onSubscribe = (event: any) => emitDetail('subscribe', event)
|
|
349
|
+
const onLogin = (event: any) => emitDetail('login', event)
|
|
350
|
+
const onIm = (event: any) => emitDetail('im', event)
|
|
351
|
+
</script>
|
|
352
|
+
|
|
353
|
+
<style lang="scss">
|
|
354
|
+
@import '../../styles/color.scss';
|
|
355
|
+
|
|
356
|
+
.uv-button-wrapper {
|
|
357
|
+
position: relative;
|
|
358
|
+
}
|
|
359
|
+
.uv-button-wrapper--dis {
|
|
360
|
+
position: absolute;
|
|
361
|
+
left: 0;
|
|
362
|
+
top: 0;
|
|
363
|
+
right: 0;
|
|
364
|
+
bottom: 0;
|
|
365
|
+
z-index: 9;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.uv-button {
|
|
369
|
+
position: relative;
|
|
370
|
+
/* #ifndef APP-NVUE */
|
|
371
|
+
display: flex;
|
|
372
|
+
box-sizing: border-box;
|
|
373
|
+
width: 100%;
|
|
374
|
+
/* #endif */
|
|
375
|
+
height: 40px;
|
|
376
|
+
flex-direction: row;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: center;
|
|
379
|
+
border-style: solid;
|
|
380
|
+
border-width: 0;
|
|
381
|
+
padding: 0 12px;
|
|
382
|
+
font-size: 14px;
|
|
383
|
+
}
|
|
384
|
+
.uv-button--large {
|
|
385
|
+
/* #ifndef APP-NVUE */
|
|
386
|
+
width: 100%;
|
|
387
|
+
/* #endif */
|
|
388
|
+
height: 50px;
|
|
389
|
+
padding: 0 15px;
|
|
390
|
+
}
|
|
391
|
+
.uv-button--normal {
|
|
392
|
+
padding: 0 12px;
|
|
393
|
+
font-size: 14px;
|
|
394
|
+
}
|
|
395
|
+
.uv-button--small {
|
|
396
|
+
height: 30px;
|
|
397
|
+
padding: 0 8px;
|
|
398
|
+
font-size: 12px;
|
|
399
|
+
/* #ifndef APP-NVUE */
|
|
400
|
+
min-width: 60px;
|
|
401
|
+
/* #endif */
|
|
402
|
+
}
|
|
403
|
+
.uv-button--mini {
|
|
404
|
+
height: 22px;
|
|
405
|
+
font-size: 10px;
|
|
406
|
+
padding: 0 8px;
|
|
407
|
+
/* #ifndef APP-NVUE */
|
|
408
|
+
min-width: 50px;
|
|
409
|
+
/* #endif */
|
|
410
|
+
}
|
|
411
|
+
.uv-button--disabled {
|
|
412
|
+
opacity: 0.5;
|
|
413
|
+
}
|
|
414
|
+
.uv-button--info {
|
|
415
|
+
color: #323233;
|
|
416
|
+
background-color: #fff;
|
|
417
|
+
border-color: #ebedf0;
|
|
418
|
+
border-width: 1px;
|
|
419
|
+
border-style: solid;
|
|
420
|
+
}
|
|
421
|
+
.uv-button--success {
|
|
422
|
+
color: #fff;
|
|
423
|
+
background-color: $uv-success;
|
|
424
|
+
border-color: $uv-success;
|
|
425
|
+
border-width: 1px;
|
|
426
|
+
border-style: solid;
|
|
427
|
+
}
|
|
428
|
+
.uv-button--primary {
|
|
429
|
+
color: #fff;
|
|
430
|
+
background-color: $uv-primary;
|
|
431
|
+
border-color: $uv-primary;
|
|
432
|
+
border-width: 1px;
|
|
433
|
+
border-style: solid;
|
|
434
|
+
}
|
|
435
|
+
.uv-button--error {
|
|
436
|
+
color: #fff;
|
|
437
|
+
background-color: $uv-error;
|
|
438
|
+
border-color: $uv-error;
|
|
439
|
+
border-width: 1px;
|
|
440
|
+
border-style: solid;
|
|
441
|
+
}
|
|
442
|
+
.uv-button--warning {
|
|
443
|
+
color: #fff;
|
|
444
|
+
background-color: $uv-warning;
|
|
445
|
+
border-color: $uv-warning;
|
|
446
|
+
border-width: 1px;
|
|
447
|
+
border-style: solid;
|
|
448
|
+
}
|
|
449
|
+
.uv-button--block {
|
|
450
|
+
/* #ifndef APP-NVUE */
|
|
451
|
+
display: flex;
|
|
452
|
+
width: 100%;
|
|
453
|
+
/* #endif */
|
|
454
|
+
flex-direction: row;
|
|
455
|
+
}
|
|
456
|
+
.uv-button--circle {
|
|
457
|
+
border-top-right-radius: 100px;
|
|
458
|
+
border-top-left-radius: 100px;
|
|
459
|
+
border-bottom-left-radius: 100px;
|
|
460
|
+
border-bottom-right-radius: 100px;
|
|
461
|
+
}
|
|
462
|
+
.uv-button--square {
|
|
463
|
+
border-top-right-radius: 3px;
|
|
464
|
+
border-top-left-radius: 3px;
|
|
465
|
+
border-bottom-left-radius: 3px;
|
|
466
|
+
border-bottom-right-radius: 3px;
|
|
467
|
+
}
|
|
468
|
+
.uv-button--plain {
|
|
469
|
+
background-color: #fff;
|
|
470
|
+
}
|
|
471
|
+
/* 浅色按钮:背景取主题色 light、边框取主题色(info 与普通 info 一致 #ebedf0)、文字/图标取主题色。
|
|
472
|
+
边框宽度不在此处固定,交由 `.uv-button--hairline`(默认 0.5px)与类型默认(1px)控制。 */
|
|
473
|
+
.uv-button--light.uv-button--info {
|
|
474
|
+
background-color: $uv-info-light;
|
|
475
|
+
/* 与普通 info 按钮边框一致 */
|
|
476
|
+
border-color: #ebedf0;
|
|
477
|
+
}
|
|
478
|
+
.uv-button--light.uv-button--primary {
|
|
479
|
+
background-color: $uv-primary-light;
|
|
480
|
+
border-color: $uv-primary;
|
|
481
|
+
}
|
|
482
|
+
.uv-button--light.uv-button--success {
|
|
483
|
+
background-color: $uv-success-light;
|
|
484
|
+
border-color: $uv-success;
|
|
485
|
+
}
|
|
486
|
+
.uv-button--light.uv-button--error {
|
|
487
|
+
background-color: $uv-error-light;
|
|
488
|
+
border-color: $uv-error;
|
|
489
|
+
}
|
|
490
|
+
.uv-button--light.uv-button--warning {
|
|
491
|
+
background-color: $uv-warning-light;
|
|
492
|
+
border-color: $uv-warning;
|
|
493
|
+
}
|
|
494
|
+
.uv-button--plain.uv-button--info {
|
|
495
|
+
color: $uv-info;
|
|
496
|
+
}
|
|
497
|
+
.uv-button--plain.uv-button--success {
|
|
498
|
+
color: $uv-success;
|
|
499
|
+
}
|
|
500
|
+
.uv-button--plain.uv-button--error {
|
|
501
|
+
color: $uv-error;
|
|
502
|
+
}
|
|
503
|
+
.uv-button--plain.uv-button--warning {
|
|
504
|
+
color: $uv-warning;
|
|
505
|
+
}
|
|
506
|
+
.uv-button--plain.uv-button--primary {
|
|
507
|
+
color: $uv-primary;
|
|
508
|
+
}
|
|
509
|
+
.uv-button--hairline {
|
|
510
|
+
border-width: 0.5px;
|
|
511
|
+
}
|
|
512
|
+
/* 点击态(全平台通用,App x / nvue 同样生效;类名均为单 class,避免复合选择器匹配问题):
|
|
513
|
+
普通按钮背景取主题色 dark;plain 取主题色 light;
|
|
514
|
+
light 按钮由 hover-class 挂 uv-button--light-active,整体 opacity 0.7;
|
|
515
|
+
自定义 color(无法派生 dark)使用整体透明度。 */
|
|
516
|
+
.uv-button--active-info {
|
|
517
|
+
background-color: $uv-info-light;
|
|
518
|
+
}
|
|
519
|
+
.uv-button--active-primary {
|
|
520
|
+
background-color: $uv-primary-dark;
|
|
521
|
+
}
|
|
522
|
+
.uv-button--active-success {
|
|
523
|
+
background-color: $uv-success-dark;
|
|
524
|
+
}
|
|
525
|
+
.uv-button--active-error {
|
|
526
|
+
background-color: $uv-error-dark;
|
|
527
|
+
}
|
|
528
|
+
.uv-button--active-warning {
|
|
529
|
+
background-color: $uv-warning-dark;
|
|
530
|
+
}
|
|
531
|
+
.uv-button--active-plain-info {
|
|
532
|
+
background-color: $uv-bg-color;
|
|
533
|
+
}
|
|
534
|
+
.uv-button--active-plain-primary {
|
|
535
|
+
background-color: $uv-primary-light;
|
|
536
|
+
}
|
|
537
|
+
.uv-button--active-plain-success {
|
|
538
|
+
background-color: $uv-success-light;
|
|
539
|
+
}
|
|
540
|
+
.uv-button--active-plain-error {
|
|
541
|
+
background-color: $uv-error-light;
|
|
542
|
+
}
|
|
543
|
+
.uv-button--active-plain-warning {
|
|
544
|
+
background-color: $uv-warning-light;
|
|
545
|
+
}
|
|
546
|
+
.uv-button--light-active {
|
|
547
|
+
opacity: 0.7;
|
|
548
|
+
}
|
|
549
|
+
.uv-button--active-custom {
|
|
550
|
+
opacity: 0.85;
|
|
551
|
+
}
|
|
552
|
+
.uv-button__text {
|
|
553
|
+
/* #ifndef APP-NVUE */
|
|
554
|
+
white-space: nowrap;
|
|
555
|
+
line-height: 1;
|
|
556
|
+
/* #endif */
|
|
557
|
+
}
|
|
558
|
+
.uv-button__loading-text {
|
|
559
|
+
/* #ifndef APP-NVUE */
|
|
560
|
+
white-space: nowrap;
|
|
561
|
+
line-height: 1;
|
|
562
|
+
/* #endif */
|
|
563
|
+
margin-left: 4px;
|
|
564
|
+
}
|
|
565
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import config from '../../utils/config';
|
|
4
|
+
|
|
5
|
+
const props = {
|
|
6
|
+
// checkbox的名称
|
|
7
|
+
name: {
|
|
8
|
+
type: [String, Number, Boolean],
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
// 形状,square为方形,circle为圆型
|
|
12
|
+
shape: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: '',
|
|
15
|
+
},
|
|
16
|
+
// 整体的大小
|
|
17
|
+
size: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: '',
|
|
20
|
+
},
|
|
21
|
+
// 是否默认选中
|
|
22
|
+
checked: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
// 是否禁用
|
|
27
|
+
disabled: {
|
|
28
|
+
type: [String, Boolean],
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
// 选中状态下的颜色
|
|
32
|
+
activeColor: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
// 未选中的颜色
|
|
37
|
+
inactiveColor: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '',
|
|
40
|
+
},
|
|
41
|
+
// 图标的大小,单位px
|
|
42
|
+
iconSize: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
// 图标颜色
|
|
47
|
+
iconColor: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '',
|
|
50
|
+
},
|
|
51
|
+
// label提示文字
|
|
52
|
+
label: {
|
|
53
|
+
type: [String, Number, Boolean],
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
// label的字体大小,px单位
|
|
57
|
+
labelSize: {
|
|
58
|
+
type: [String, Number],
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
// label的颜色
|
|
62
|
+
labelColor: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
// 是否禁止点击提示语选中复选框
|
|
67
|
+
labelDisabled: {
|
|
68
|
+
type: [String, Boolean],
|
|
69
|
+
default: '',
|
|
70
|
+
},
|
|
71
|
+
customStyle: {
|
|
72
|
+
type: [Object, String],
|
|
73
|
+
default: () => ({}),
|
|
74
|
+
},
|
|
75
|
+
customClass: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
...config.props.checkbox,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default props;
|