@gmcb/uv-ui 0.2.26
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 +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-drop-down-item" @click="clickHandler">
|
|
3
|
+
<uv-text :text="label" :size="getTextStyle.size" :color="getTextStyle.color" lines="1" :custom-style="{marginRight: '10rpx',maxWidth:'200rpx'}"></uv-text>
|
|
4
|
+
<uv-icon :name="getDownIcon.name" :size="getDownIcon.size" :color="getDownIcon.color" v-if="[1,'1'].indexOf(type)==-1"></uv-icon>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
<script>
|
|
8
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
9
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
10
|
+
/**
|
|
11
|
+
* DropDown 下拉框
|
|
12
|
+
* @description 下拉筛选
|
|
13
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?name=uv-drop-down
|
|
14
|
+
* @property {String | Number} name 字段标识
|
|
15
|
+
* @property {String | Number} type 类型 1 没有筛选项,直接进行选中和不选中 2 有多个选项
|
|
16
|
+
* @property {String | Number} label 筛选项的文本
|
|
17
|
+
* @property {Boolean} isDrop 该项是否打开
|
|
18
|
+
*/
|
|
19
|
+
export default {
|
|
20
|
+
name: 'uv-drop-down-item',
|
|
21
|
+
mixins: [mpMixin, mixin],
|
|
22
|
+
emits: ['click'],
|
|
23
|
+
props: {
|
|
24
|
+
name: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
// 类型 1 没有筛选项,直接进行选中和不选中 2 有多个选项
|
|
29
|
+
type: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
default: '2'
|
|
32
|
+
},
|
|
33
|
+
// 筛选的文本
|
|
34
|
+
label: {
|
|
35
|
+
type: [String],
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
// 筛选值
|
|
39
|
+
value: {
|
|
40
|
+
type: [String, Number, null],
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
// 是否下拉菜单打开
|
|
44
|
+
isDrop: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
data() {
|
|
50
|
+
return {
|
|
51
|
+
parentData: {
|
|
52
|
+
defaultValue: [0, '0', 'all'],
|
|
53
|
+
textSize: '30rpx',
|
|
54
|
+
textColor: '#333',
|
|
55
|
+
textActiveSize: '30rpx',
|
|
56
|
+
textActiveColor: '#3c9cff',
|
|
57
|
+
extraIcon: {},
|
|
58
|
+
extraActiveIcon: {},
|
|
59
|
+
sign: '',
|
|
60
|
+
clickHandler: Function
|
|
61
|
+
},
|
|
62
|
+
active: false,
|
|
63
|
+
isDroped: false,
|
|
64
|
+
elId: ''
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
isDrop: {
|
|
69
|
+
handler(newVal) {
|
|
70
|
+
this.isDroped = newVal;
|
|
71
|
+
},
|
|
72
|
+
immediate: true
|
|
73
|
+
},
|
|
74
|
+
value: {
|
|
75
|
+
handler(newVal) {
|
|
76
|
+
this.$nextTick(()=>{
|
|
77
|
+
this.active = this.parentData.defaultValue.indexOf(newVal) == -1;
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
immediate: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
getDownIcon() {
|
|
85
|
+
const style = {
|
|
86
|
+
size: '30rpx',
|
|
87
|
+
color: '#333',
|
|
88
|
+
...this.parentData.extraIcon
|
|
89
|
+
}
|
|
90
|
+
if (this.active || this.isDroped) {
|
|
91
|
+
style.color = this.parentData.extraActiveIcon?.color ? this.parentData.extraActiveIcon?.color : '#3c9cff';
|
|
92
|
+
style.size = this.parentData.extraActiveIcon?.size ? this.parentData.extraActiveIcon?.size : '30rpx';
|
|
93
|
+
}
|
|
94
|
+
if (this.isDroped) {
|
|
95
|
+
style.name = this.parentData.extraActiveIcon?.name;
|
|
96
|
+
}
|
|
97
|
+
return style;
|
|
98
|
+
},
|
|
99
|
+
getTextStyle() {
|
|
100
|
+
const style = {
|
|
101
|
+
size: this.parentData.textSize,
|
|
102
|
+
color: this.parentData.textColor
|
|
103
|
+
};
|
|
104
|
+
if (this.active || this.isDroped) {
|
|
105
|
+
style.size = this.parentData.textActiveSize;
|
|
106
|
+
style.color = this.parentData.textActiveColor;
|
|
107
|
+
}
|
|
108
|
+
return style;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
created() {
|
|
112
|
+
this.init();
|
|
113
|
+
},
|
|
114
|
+
methods: {
|
|
115
|
+
init() {
|
|
116
|
+
this.elId = this.$uv.guid();
|
|
117
|
+
this.getParentData('uv-drop-down');
|
|
118
|
+
if (!this.parent) {
|
|
119
|
+
this.$uv.error('uv-drop-down必须搭配uv-drop-down-item组件使用');
|
|
120
|
+
}
|
|
121
|
+
uni.$on('HANDLE_DROPDOWN_ONE', id => {
|
|
122
|
+
if (this.isDroped && this.elId != id) {
|
|
123
|
+
this.isDroped = false;
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
uni.$on(`${this.parentData.sign}_CLOSEPOPUP`, async () => {
|
|
127
|
+
if (this.isDroped) {
|
|
128
|
+
this.isDroped = false;
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
async clickHandler() {
|
|
133
|
+
let data = {};
|
|
134
|
+
uni.$emit('HANDLE_DROPDOWN_ONE', this.elId);
|
|
135
|
+
switch (+this.type) {
|
|
136
|
+
case 1:
|
|
137
|
+
this.active = !this.active;
|
|
138
|
+
data = {
|
|
139
|
+
name: this.name,
|
|
140
|
+
active: this.active,
|
|
141
|
+
type: this.type
|
|
142
|
+
};
|
|
143
|
+
break;
|
|
144
|
+
case 2:
|
|
145
|
+
this.isDroped = !this.isDroped;
|
|
146
|
+
data = {
|
|
147
|
+
name: this.name,
|
|
148
|
+
active: this.isDroped,
|
|
149
|
+
type: this.type
|
|
150
|
+
};
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
this.parentData.clickHandler(data);
|
|
154
|
+
this.$emit('click', data);
|
|
155
|
+
uni.$emit(`${this.parentData.sign}_CLICKMENU`, {
|
|
156
|
+
show: +this.type > 1 && this.isDroped
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
<style scoped lang="scss">
|
|
163
|
+
@import '../../libs/css/components.scss';
|
|
164
|
+
.uv-drop-down-item {
|
|
165
|
+
@include flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
padding: 20rpx;
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-drop-down-popup">
|
|
3
|
+
<uv-transition :show="show" mode="fade" :duration="300" :custom-style="overlayStyle" @click="clickOverlay">
|
|
4
|
+
<view class="uv-dp__container" ref="uvDPContainer" :style="{height: `${height}px`}" @click.stop="blockClick">
|
|
5
|
+
<view class="uv-dp__container__list" ref="uvDPList">
|
|
6
|
+
<slot>
|
|
7
|
+
<view class="uv-dp__container__list--item" v-for="(item,index) in list" :key="index" @click="clickHandler(item,index)" :style="[itemCustomStyle(index)]">
|
|
8
|
+
<uv-text :text="item[keyName]" :size="getTextSize(index)" :color="getTextColor(index)"></uv-text>
|
|
9
|
+
</view>
|
|
10
|
+
</slot>
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
</uv-transition>
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
<script>
|
|
17
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
18
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
19
|
+
// #ifdef APP-NVUE
|
|
20
|
+
const animation = uni.requireNativePlugin('animation');
|
|
21
|
+
const dom = uni.requireNativePlugin('dom');
|
|
22
|
+
// #endif
|
|
23
|
+
/**
|
|
24
|
+
* DropDownPopup 下拉框
|
|
25
|
+
* @description 下拉筛选框
|
|
26
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?name=uv-drop-down
|
|
27
|
+
* @property {String | Number} name 字段标识
|
|
28
|
+
* @property {String | Number} zIndex 弹出层的层级
|
|
29
|
+
* @property {String | Number} opacity 遮罩层的透明度
|
|
30
|
+
* @property {Boolean} clickOverlayOnClose 是否允许点击遮罩层关闭弹窗
|
|
31
|
+
* @property {Object} currentDropItem 当前下拉筛选菜单对象
|
|
32
|
+
* @property {String} keyName 指定从当前下拉筛选菜单对象元素中读取哪个属性作为文本展示
|
|
33
|
+
*/
|
|
34
|
+
export default {
|
|
35
|
+
name: 'uv-drop-down-popup',
|
|
36
|
+
mixins: [mpMixin, mixin],
|
|
37
|
+
props: {
|
|
38
|
+
sign: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
default: 'UVDROPDOWN'
|
|
41
|
+
},
|
|
42
|
+
zIndex: {
|
|
43
|
+
type: [Number, String],
|
|
44
|
+
default: 999
|
|
45
|
+
},
|
|
46
|
+
opacity: {
|
|
47
|
+
type: [Number, String],
|
|
48
|
+
default: 0.5
|
|
49
|
+
},
|
|
50
|
+
clickOverlayOnClose: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
54
|
+
// 当前下拉选项对象
|
|
55
|
+
currentDropItem: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default () {
|
|
58
|
+
return {
|
|
59
|
+
activeIndex: 0,
|
|
60
|
+
child: []
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
keyName: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'label'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
data() {
|
|
70
|
+
return {
|
|
71
|
+
show: false,
|
|
72
|
+
rect: {},
|
|
73
|
+
height: 0
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
overlayStyle() {
|
|
78
|
+
let { height = 0, top = 0 } = this.rect;
|
|
79
|
+
// #ifdef H5
|
|
80
|
+
top += this.$uv.sys().windowTop;
|
|
81
|
+
// #endif
|
|
82
|
+
const style = {
|
|
83
|
+
position: 'fixed',
|
|
84
|
+
top: `${top+height}px`,
|
|
85
|
+
left: 0,
|
|
86
|
+
right: 0,
|
|
87
|
+
zIndex: this.zIndex,
|
|
88
|
+
bottom: 0,
|
|
89
|
+
'background-color': `rgba(0, 0, 0, ${this.opacity})`
|
|
90
|
+
}
|
|
91
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
92
|
+
},
|
|
93
|
+
list() {
|
|
94
|
+
try {
|
|
95
|
+
return Array.isArray(this.currentDropItem.child) ? this.currentDropItem.child : [];
|
|
96
|
+
} catch (e) {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
getTextColor(index) {
|
|
101
|
+
return index => {
|
|
102
|
+
const active = this.currentDropItem.activeIndex == index;
|
|
103
|
+
const color = this.currentDropItem.color;
|
|
104
|
+
const activeColor = this.currentDropItem.activeColor;
|
|
105
|
+
if (active) {
|
|
106
|
+
return activeColor ? activeColor : '#3c9cff';
|
|
107
|
+
}
|
|
108
|
+
return color ? color : '#333';
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
getTextSize(index) {
|
|
112
|
+
return index => {
|
|
113
|
+
const active = this.currentDropItem.activeIndex == index;
|
|
114
|
+
const size = this.currentDropItem.size;
|
|
115
|
+
const activeSize = this.currentDropItem.activeSize;
|
|
116
|
+
if (active) {
|
|
117
|
+
return activeSize ? activeSize : '30rpx';
|
|
118
|
+
}
|
|
119
|
+
return size ? size : '30rpx';
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
itemCustomStyle() {
|
|
123
|
+
return index => {
|
|
124
|
+
const active = this.currentDropItem.activeIndex == index;
|
|
125
|
+
const style = {};
|
|
126
|
+
if (active && this.currentDropItem.itemActiveCustomStyle) {
|
|
127
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.currentDropItem.itemActiveCustomStyle));
|
|
128
|
+
}
|
|
129
|
+
if (this.currentDropItem.itemCustomStyle) {
|
|
130
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.currentDropItem.itemCustomStyle))
|
|
131
|
+
}
|
|
132
|
+
return style;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
created() {
|
|
137
|
+
this.init();
|
|
138
|
+
},
|
|
139
|
+
methods: {
|
|
140
|
+
blockClick() {},
|
|
141
|
+
clickHandler(item, index) {
|
|
142
|
+
this.currentDropItem.activeIndex = index;
|
|
143
|
+
this.$emit('clickItem', item);
|
|
144
|
+
this.close();
|
|
145
|
+
},
|
|
146
|
+
init() {
|
|
147
|
+
uni.$off(`${this.sign}_GETRECT`);
|
|
148
|
+
uni.$on(`${this.sign}_GETRECT`, rect => {
|
|
149
|
+
this.rect = rect;
|
|
150
|
+
})
|
|
151
|
+
uni.$off(`${this.sign}_CLICKMENU`);
|
|
152
|
+
uni.$on(`${this.sign}_CLICKMENU`, async res => {
|
|
153
|
+
if (res.show) {
|
|
154
|
+
this.open();
|
|
155
|
+
} else {
|
|
156
|
+
this.close();
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
open() {
|
|
161
|
+
this.show = true;
|
|
162
|
+
this.$nextTick(async () => {
|
|
163
|
+
// #ifndef H5 || MP-WEIXIN
|
|
164
|
+
await this.$uv.sleep(60);
|
|
165
|
+
// #endif
|
|
166
|
+
const res = await this.queryRect();
|
|
167
|
+
// #ifndef APP-NVUE
|
|
168
|
+
this.height = res.height;
|
|
169
|
+
// #endif
|
|
170
|
+
// #ifdef APP-NVUE
|
|
171
|
+
this.animation(res.height);
|
|
172
|
+
// #endif
|
|
173
|
+
this.$emit('popupChange', { show: true });
|
|
174
|
+
})
|
|
175
|
+
},
|
|
176
|
+
close() {
|
|
177
|
+
if(!this.show) return;
|
|
178
|
+
this.height = 0;
|
|
179
|
+
// #ifndef APP-NVUE
|
|
180
|
+
this.height = 0;
|
|
181
|
+
// #endif
|
|
182
|
+
// #ifdef APP-NVUE
|
|
183
|
+
this.animation(0);
|
|
184
|
+
// #endif
|
|
185
|
+
this.show = false;
|
|
186
|
+
uni.$emit(`${this.sign}_CLOSEPOPUP`);
|
|
187
|
+
this.$emit('popupChange', { show: false });
|
|
188
|
+
},
|
|
189
|
+
clickOverlay() {
|
|
190
|
+
if (this.clickOverlayOnClose) {
|
|
191
|
+
this.close();
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
// 查询内容高度
|
|
195
|
+
queryRect() {
|
|
196
|
+
// #ifndef APP-NVUE
|
|
197
|
+
// 组件内部一般用this.$uvGetRect,对外的为getRect,二者功能一致,名称不同
|
|
198
|
+
return new Promise(resolve => {
|
|
199
|
+
this.$uvGetRect(`.uv-dp__container__list`).then(size => {
|
|
200
|
+
resolve(size)
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
// #endif
|
|
204
|
+
// #ifdef APP-NVUE
|
|
205
|
+
// nvue下,使用dom模块查询元素高度
|
|
206
|
+
// 返回一个promise,让调用此方法的主体能使用then回调
|
|
207
|
+
return new Promise(resolve => {
|
|
208
|
+
dom.getComponentRect(this.$refs.uvDPList, res => {
|
|
209
|
+
resolve(res.size)
|
|
210
|
+
})
|
|
211
|
+
})
|
|
212
|
+
// #endif
|
|
213
|
+
},
|
|
214
|
+
// nvue下设置高度
|
|
215
|
+
animation(height, duration = 200) {
|
|
216
|
+
// #ifdef APP-NVUE
|
|
217
|
+
const ref = this.$refs['uvDPContainer'];
|
|
218
|
+
animation.transition(ref, {
|
|
219
|
+
styles: {
|
|
220
|
+
height: `${height}px`
|
|
221
|
+
},
|
|
222
|
+
duration
|
|
223
|
+
})
|
|
224
|
+
// #endif
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
</script>
|
|
229
|
+
<style scoped lang="scss">
|
|
230
|
+
.uv-dp__container {
|
|
231
|
+
/* #ifndef APP-NVUE */
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
transition: all .15s;
|
|
234
|
+
/* #endif */
|
|
235
|
+
background-color: #fff;
|
|
236
|
+
}
|
|
237
|
+
.uv-dp__container__list {
|
|
238
|
+
&--item {
|
|
239
|
+
padding: 20rpx 60rpx;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 内置图标名称,或图片路径,建议绝对路径
|
|
4
|
+
icon: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: ''
|
|
7
|
+
},
|
|
8
|
+
// 提示文字
|
|
9
|
+
text: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ''
|
|
12
|
+
},
|
|
13
|
+
// 文字颜色
|
|
14
|
+
textColor: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '#c0c4cc'
|
|
17
|
+
},
|
|
18
|
+
// 文字大小
|
|
19
|
+
textSize: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: 14
|
|
22
|
+
},
|
|
23
|
+
// 图标的颜色
|
|
24
|
+
iconColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '#c0c4cc'
|
|
27
|
+
},
|
|
28
|
+
// 图标的大小
|
|
29
|
+
iconSize: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
default: 90
|
|
32
|
+
},
|
|
33
|
+
// 选择预置的图标类型
|
|
34
|
+
mode: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'data'
|
|
37
|
+
},
|
|
38
|
+
// 图标宽度,单位px
|
|
39
|
+
width: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: 160
|
|
42
|
+
},
|
|
43
|
+
// 图标高度,单位px
|
|
44
|
+
height: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
default: 160
|
|
47
|
+
},
|
|
48
|
+
// 是否显示组件
|
|
49
|
+
show: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
// 组件距离上一个元素之间的距离,默认px单位
|
|
54
|
+
marginTop: {
|
|
55
|
+
type: [String, Number],
|
|
56
|
+
default: 0
|
|
57
|
+
},
|
|
58
|
+
...uni.$uv?.props?.empty
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-empty"
|
|
4
|
+
:style="[emptyStyle]"
|
|
5
|
+
v-if="show"
|
|
6
|
+
>
|
|
7
|
+
<uv-icon
|
|
8
|
+
v-if="!isImg"
|
|
9
|
+
:name="mode === 'message' ? 'chat' : `empty-${mode}`"
|
|
10
|
+
:size="iconSize"
|
|
11
|
+
:color="iconColor"
|
|
12
|
+
margin-top="14"
|
|
13
|
+
></uv-icon>
|
|
14
|
+
<image
|
|
15
|
+
v-else
|
|
16
|
+
:style="{
|
|
17
|
+
width: $uv.addUnit(width),
|
|
18
|
+
height: $uv.addUnit(height)
|
|
19
|
+
}"
|
|
20
|
+
:src="icon"
|
|
21
|
+
mode="widthFix"
|
|
22
|
+
></image>
|
|
23
|
+
<text
|
|
24
|
+
class="uv-empty__text"
|
|
25
|
+
:style="[textStyle]"
|
|
26
|
+
>{{text ? text : icons[mode]}}</text>
|
|
27
|
+
<view class="uv-empty__wrap">
|
|
28
|
+
<slot />
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
<script>
|
|
33
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
34
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
35
|
+
import props from './props.js';
|
|
36
|
+
/**
|
|
37
|
+
* empty 内容为空
|
|
38
|
+
* @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
|
|
39
|
+
* @tutorial https://www.uvui.cn/components/empty.html
|
|
40
|
+
* @property {String} icon 内置图标名称,或图片路径,建议绝对路径
|
|
41
|
+
* @property {String} text 提示文字
|
|
42
|
+
* @property {String} textColor 文字颜色 (默认 '#c0c4cc' )
|
|
43
|
+
* @property {String | Number} textSize 文字大小 (默认 14 )
|
|
44
|
+
* @property {String} iconColor 图标的颜色 (默认 '#c0c4cc' )
|
|
45
|
+
* @property {String | Number} iconSize 图标的大小 (默认 90 )
|
|
46
|
+
* @property {String} mode 选择预置的图标类型 (默认 'data' )
|
|
47
|
+
* @property {String | Number} width 图标宽度,单位px (默认 160 )
|
|
48
|
+
* @property {String | Number} height 图标高度,单位px (默认 160 )
|
|
49
|
+
* @property {Boolean} show 是否显示组件 (默认 true )
|
|
50
|
+
* @property {String | Number} marginTop 组件距离上一个元素之间的距离,默认px单位 (默认 0 )
|
|
51
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
52
|
+
*
|
|
53
|
+
* @event {Function} click 点击组件时触发
|
|
54
|
+
* @event {Function} close 点击关闭按钮时触发
|
|
55
|
+
* @example <uv-empty text="所谓伊人,在水一方" mode="list"></uv-empty>
|
|
56
|
+
*/
|
|
57
|
+
export default {
|
|
58
|
+
name: "uv-empty",
|
|
59
|
+
mixins: [mpMixin, mixin, props],
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
icons: {
|
|
63
|
+
car: '购物车为空',
|
|
64
|
+
page: '页面不存在',
|
|
65
|
+
search: '没有搜索结果',
|
|
66
|
+
address: '没有收货地址',
|
|
67
|
+
'wifi-off': '没有WiFi',
|
|
68
|
+
order: '订单为空',
|
|
69
|
+
coupon: '没有优惠券',
|
|
70
|
+
favor: '暂无收藏',
|
|
71
|
+
permission: '无权限',
|
|
72
|
+
history: '无历史记录',
|
|
73
|
+
news: '无新闻列表',
|
|
74
|
+
message: '消息列表为空',
|
|
75
|
+
list: '列表为空',
|
|
76
|
+
data: '数据为空',
|
|
77
|
+
comment: '暂无评论',
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
computed: {
|
|
82
|
+
// 组件样式
|
|
83
|
+
emptyStyle() {
|
|
84
|
+
const style = {}
|
|
85
|
+
style.marginTop = this.$uv.addUnit(this.marginTop)
|
|
86
|
+
// 合并customStyle样式,此参数通过mixin中的props传递
|
|
87
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
88
|
+
},
|
|
89
|
+
// 文本样式
|
|
90
|
+
textStyle() {
|
|
91
|
+
const style = {}
|
|
92
|
+
style.color = this.textColor
|
|
93
|
+
style.fontSize = this.$uv.addUnit(this.textSize)
|
|
94
|
+
return style
|
|
95
|
+
},
|
|
96
|
+
// 判断icon是否图片路径
|
|
97
|
+
isImg() {
|
|
98
|
+
const isBase64 = this.icon.indexOf('data:') > -1 && this.icon.indexOf('base64') > -1;
|
|
99
|
+
return this.icon.indexOf('/') !== -1 || isBase64;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
<style lang="scss" scoped>
|
|
105
|
+
@import '../../libs/css/components.scss';
|
|
106
|
+
$uv-empty-text-margin-top: 20rpx !default;
|
|
107
|
+
$uv-empty-slot-margin-top: 20rpx !default;
|
|
108
|
+
.uv-empty {
|
|
109
|
+
@include flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
113
|
+
&__text {
|
|
114
|
+
@include flex;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
align-items: center;
|
|
117
|
+
margin-top: $uv-empty-text-margin-top;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.uv-slot-wrap {
|
|
121
|
+
@include flex;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
align-items: center;
|
|
124
|
+
margin-top: $uv-empty-slot-margin-top;
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 当前form的需要验证字段的集合
|
|
4
|
+
model: {
|
|
5
|
+
type: Object,
|
|
6
|
+
default: () => ({})
|
|
7
|
+
},
|
|
8
|
+
// 验证规则
|
|
9
|
+
rules: {
|
|
10
|
+
type: [Object, Function, Array],
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
// 有错误时的提示方式,message-提示信息,toast-进行toast提示
|
|
14
|
+
// border-bottom-下边框呈现红色,none-无提示
|
|
15
|
+
errorType: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'message'
|
|
18
|
+
},
|
|
19
|
+
// 是否显示表单域的下划线边框
|
|
20
|
+
borderBottom: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
// label的位置,left-左边,top-上边
|
|
25
|
+
labelPosition: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'left'
|
|
28
|
+
},
|
|
29
|
+
// label的宽度,单位px
|
|
30
|
+
labelWidth: {
|
|
31
|
+
type: [String, Number],
|
|
32
|
+
default: 45
|
|
33
|
+
},
|
|
34
|
+
// lable字体的对齐方式
|
|
35
|
+
labelAlign: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'left'
|
|
38
|
+
},
|
|
39
|
+
// lable的样式,对象形式
|
|
40
|
+
labelStyle: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({})
|
|
43
|
+
},
|
|
44
|
+
...uni.$uv?.props?.form
|
|
45
|
+
}
|
|
46
|
+
}
|