dpzvc3-ui 3.0.0
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/LICENSE +20 -0
- package/README.md +175 -0
- package/build-style.js +58 -0
- package/dist/dpzvc3.esm.js +17676 -0
- package/dist/dpzvc3.esm.js.map +1 -0
- package/dist/dpzvc3.esm.min.js +2 -0
- package/dist/dpzvc3.esm.min.js.map +1 -0
- package/dist/dpzvc3.js +15200 -0
- package/dist/dpzvc3.js.map +1 -0
- package/dist/dpzvc3.min.js +2 -0
- package/dist/dpzvc3.min.js.map +1 -0
- package/dist/styles/base/font.css +1 -0
- package/dist/styles/base/reset.css +1 -0
- package/dist/styles/base/variable.css +0 -0
- package/dist/styles/components/actionSheet.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/cell-swipe.css +1 -0
- package/dist/styles/components/cell.css +1 -0
- package/dist/styles/components/checkBox.css +1 -0
- package/dist/styles/components/editor.css +1 -0
- package/dist/styles/components/header.css +1 -0
- package/dist/styles/components/indicator.css +1 -0
- package/dist/styles/components/loadmore.css +1 -0
- package/dist/styles/components/message.css +1 -0
- package/dist/styles/components/modal.css +1 -0
- package/dist/styles/components/number.css +1 -0
- package/dist/styles/components/picker.css +1 -0
- package/dist/styles/components/popup.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/prompt.css +1 -0
- package/dist/styles/components/radioBox.css +1 -0
- package/dist/styles/components/slide-Bar.css +1 -0
- package/dist/styles/components/spinner.css +1 -0
- package/dist/styles/components/swipe.css +1 -0
- package/dist/styles/components/switchBar.css +1 -0
- package/dist/styles/components/tab.css +1 -0
- package/dist/styles/components/text.css +1 -0
- package/dist/styles/components/toTop.css +1 -0
- package/dist/styles/components/upload.css +1 -0
- package/dist/styles/dpzvc3.css +1 -0
- package/dist/styles/utils/1px.css +1 -0
- package/dist/styles/utils/animation.css +1 -0
- package/dist/styles/utils/nowrap.css +1 -0
- package/dist-prod/91.9d79b442ec3131707419.js +3 -0
- package/dist-prod/91.9d79b442ec3131707419.js.LICENSE.txt +25 -0
- package/dist-prod/91.9d79b442ec3131707419.js.map +1 -0
- package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js +2 -0
- package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js.map +1 -0
- package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js +2 -0
- package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js.map +1 -0
- package/dist-prod/button.28b491339fbba29c3f16.chunk.js +2 -0
- package/dist-prod/button.28b491339fbba29c3f16.chunk.js.map +1 -0
- package/dist-prod/card.3ad847f07bebc1391125.chunk.js +2 -0
- package/dist-prod/card.3ad847f07bebc1391125.chunk.js.map +1 -0
- package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js +2 -0
- package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js.map +1 -0
- package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js +2 -0
- package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js.map +1 -0
- package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js +2 -0
- package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js.map +1 -0
- package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js +2 -0
- package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js.map +1 -0
- package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js +2 -0
- package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js.map +1 -0
- package/dist-prod/index.html +19 -0
- package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js +2 -0
- package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js.map +1 -0
- package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js +2 -0
- package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js.map +1 -0
- package/dist-prod/main.2e9aaa9095e329ea2d7b.js +2 -0
- package/dist-prod/main.2e9aaa9095e329ea2d7b.js.map +1 -0
- package/dist-prod/message.e57fa263a214006f7191.chunk.js +2 -0
- package/dist-prod/message.e57fa263a214006f7191.chunk.js.map +1 -0
- package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js +2 -0
- package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js.map +1 -0
- package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js +2 -0
- package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js.map +1 -0
- package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js +2 -0
- package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js.map +1 -0
- package/dist-prod/progress.1e0d785044aecadc5615.chunk.js +2 -0
- package/dist-prod/progress.1e0d785044aecadc5615.chunk.js.map +1 -0
- package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js +2 -0
- package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js.map +1 -0
- package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js +2 -0
- package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js.map +1 -0
- package/dist-prod/rater.939e0e7e770728f684c3.chunk.js +2 -0
- package/dist-prod/rater.939e0e7e770728f684c3.chunk.js.map +1 -0
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js +2 -0
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js.map +1 -0
- package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js +2 -0
- package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js.map +1 -0
- package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js +2 -0
- package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js.map +1 -0
- package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js +2 -0
- package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js.map +1 -0
- package/dist-prod/tab.4c391211c41b7d12b585.chunk.js +2 -0
- package/dist-prod/tab.4c391211c41b7d12b585.chunk.js.map +1 -0
- package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js +2 -0
- package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js.map +1 -0
- package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js +2 -0
- package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js.map +1 -0
- package/dist-prod/upload.ec7a954970889869d93e.chunk.js +2 -0
- package/dist-prod/upload.ec7a954970889869d93e.chunk.js.map +1 -0
- package/images/IMG_2614 2 2.JPG +0 -0
- package/images/IMG_2614.JPG +0 -0
- package/images/IMG_2615 2.JPG +0 -0
- package/images/IMG_2615.JPG +0 -0
- package/package.json +113 -0
- package/postcss.config.js +5 -0
- package/src/components/Indicator/Indicator.vue +82 -0
- package/src/components/Indicator/index.js +86 -0
- package/src/components/Text/Number.vue +167 -0
- package/src/components/Text/index.js +7 -0
- package/src/components/Text/textBar.vue +122 -0
- package/src/components/action-sheet/actionSheet.vue +93 -0
- package/src/components/action-sheet/index.js +5 -0
- package/src/components/app.vue +61 -0
- package/src/components/badge/badge.vue +80 -0
- package/src/components/badge/index.js +5 -0
- package/src/components/button/button.vue +111 -0
- package/src/components/button/index.js +5 -0
- package/src/components/card/card.vue +49 -0
- package/src/components/card/index.js +5 -0
- package/src/components/cell/cell.vue +93 -0
- package/src/components/cell/index.js +5 -0
- package/src/components/cell-swipe/cell-swipe.vue +169 -0
- package/src/components/cell-swipe/index.js +5 -0
- package/src/components/checkBox/checkbox-group.vue +74 -0
- package/src/components/checkBox/checkbox.vue +117 -0
- package/src/components/checkBox/index.js +8 -0
- package/src/components/header/header.vue +130 -0
- package/src/components/header/index.js +5 -0
- package/src/components/loadMore/index.js +5 -0
- package/src/components/loadMore/loadmore.vue +258 -0
- package/src/components/message/confirm.js +60 -0
- package/src/components/message/index.js +111 -0
- package/src/components/message/message.vue +137 -0
- package/src/components/message/messageGroup.vue +82 -0
- package/src/components/modal/confirm.js +122 -0
- package/src/components/modal/index.js +52 -0
- package/src/components/modal/modal.vue +138 -0
- package/src/components/picker/area-picker/area-picker.vue +230 -0
- package/src/components/picker/area-picker/props.js +17 -0
- package/src/components/picker/date-picker/date-picker.vue +191 -0
- package/src/components/picker/date-picker/props.js +24 -0
- package/src/components/picker/index.js +5 -0
- package/src/components/picker/normal-picker/normal-picker.vue +120 -0
- package/src/components/picker/normal-picker/props.js +20 -0
- package/src/components/picker/picker-slot.vue +217 -0
- package/src/components/picker/picker.vue +111 -0
- package/src/components/popup/index.js +5 -0
- package/src/components/popup/popup.vue +91 -0
- package/src/components/progress/index.js +5 -0
- package/src/components/progress/progress.vue +86 -0
- package/src/components/prompt/confirm.js +91 -0
- package/src/components/prompt/index.js +53 -0
- package/src/components/prompt/prompt.vue +125 -0
- package/src/components/radioBox/index.js +8 -0
- package/src/components/radioBox/radiobox-group.vue +66 -0
- package/src/components/radioBox/radiobox.vue +88 -0
- package/src/components/rater/index.js +5 -0
- package/src/components/rater/rater.vue +118 -0
- package/src/components/slideBar/index.js +6 -0
- package/src/components/slideBar/slideBar.vue +207 -0
- package/src/components/spinner/behavior/blade.vue +42 -0
- package/src/components/spinner/behavior/double-bounce.vue +38 -0
- package/src/components/spinner/behavior/fading-circle.vue +55 -0
- package/src/components/spinner/behavior/snake.vue +41 -0
- package/src/components/spinner/behavior/triple-bounce.vue +52 -0
- package/src/components/spinner/index.js +5 -0
- package/src/components/spinner/props.js +28 -0
- package/src/components/spinner/spinner.vue +78 -0
- package/src/components/swipe/index.js +5 -0
- package/src/components/swipe/swipe.vue +281 -0
- package/src/components/switchbar/index.js +5 -0
- package/src/components/switchbar/switchbar.vue +79 -0
- package/src/components/tab/index.js +6 -0
- package/src/components/tab/tab.vue +89 -0
- package/src/components/toTop/index.js +5 -0
- package/src/components/toTop/topTop.vue +78 -0
- package/src/components/upload/index.js +5 -0
- package/src/components/upload/upload.vue +166 -0
- package/src/config/config.js +16 -0
- package/src/directives/clickoutside.js +42 -0
- package/src/directives/tranferDom.js +66 -0
- package/src/index.js +149 -0
- package/src/lib/MegaPixImage.js +163 -0
- package/src/lib/MegaPixImageOld.js +153 -0
- package/src/lib/exif-js.js +235 -0
- package/src/lib/exif.js +789 -0
- package/src/main.js +31 -0
- package/src/mixin/emitter.js +72 -0
- package/src/mixin/input.js +41 -0
- package/src/router.js +36 -0
- package/src/styles/base/font.less +99 -0
- package/src/styles/base/reset.less +135 -0
- package/src/styles/base/variable.less +108 -0
- package/src/styles/components/actionSheet.less +43 -0
- package/src/styles/components/badge.less +81 -0
- package/src/styles/components/button.less +124 -0
- package/src/styles/components/card.less +31 -0
- package/src/styles/components/cell-swipe.less +20 -0
- package/src/styles/components/cell.less +75 -0
- package/src/styles/components/checkBox.less +113 -0
- package/src/styles/components/editor.less +3 -0
- package/src/styles/components/header.less +72 -0
- package/src/styles/components/indicator.less +39 -0
- package/src/styles/components/loadmore.less +48 -0
- package/src/styles/components/message.less +57 -0
- package/src/styles/components/modal.less +84 -0
- package/src/styles/components/number.less +60 -0
- package/src/styles/components/picker.less +152 -0
- package/src/styles/components/popup.less +46 -0
- package/src/styles/components/progress.less +52 -0
- package/src/styles/components/prompt.less +37 -0
- package/src/styles/components/radioBox.less +138 -0
- package/src/styles/components/slide-Bar.less +149 -0
- package/src/styles/components/spinner.less +329 -0
- package/src/styles/components/swipe.less +125 -0
- package/src/styles/components/switchBar.less +88 -0
- package/src/styles/components/tab.less +71 -0
- package/src/styles/components/text.less +82 -0
- package/src/styles/components/toTop.less +28 -0
- package/src/styles/components/upload.less +23 -0
- package/src/styles/index.less +38 -0
- package/src/styles/utils/1px.less +206 -0
- package/src/styles/utils/animation.less +165 -0
- package/src/styles/utils/nowrap.less +19 -0
- package/src/template/index.ejs +40 -0
- package/src/utils/util.js +202 -0
- package/src/vconsole-resources.min.js +6 -0
- package/src/vconsole-sources.min.js +6 -0
- package/src/vconsole.min.js +7 -0
- package/src/views/ActionSheet.vue +46 -0
- package/src/views/Badge.vue +51 -0
- package/src/views/Button.vue +69 -0
- package/src/views/Card.vue +88 -0
- package/src/views/Cell.vue +30 -0
- package/src/views/CellSwipe.vue +68 -0
- package/src/views/CheckBox.vue +77 -0
- package/src/views/Header.vue +70 -0
- package/src/views/Indicator.vue +82 -0
- package/src/views/LoadMore.vue +73 -0
- package/src/views/Message.vue +61 -0
- package/src/views/Modal.vue +69 -0
- package/src/views/Picker.vue +140 -0
- package/src/views/Popup.vue +97 -0
- package/src/views/Progress.vue +47 -0
- package/src/views/Prompt.vue +43 -0
- package/src/views/RadioBox.vue +68 -0
- package/src/views/Rater.vue +49 -0
- package/src/views/SlideBar.vue +55 -0
- package/src/views/Spinner.vue +15 -0
- package/src/views/Swipe.vue +59 -0
- package/src/views/SwitchBar.vue +47 -0
- package/src/views/Tab.vue +53 -0
- package/src/views/Text.vue +93 -0
- package/src/views/ToTop.vue +17 -0
- package/src/views/Upload.vue +61 -0
- package/src/views/guide.vue +164 -0
- package/src/views/index.vue +554 -0
- package/webpack.base.config.js +65 -0
- package/webpack.dev.config.js +42 -0
- package/webpack.dist.dev.config.js +75 -0
- package/webpack.dist.prod.config.js +89 -0
- package/webpack.prod.config.js +51 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="classes"
|
|
4
|
+
:style="getStyles"
|
|
5
|
+
>
|
|
6
|
+
<ul
|
|
7
|
+
:class="draggingClass"
|
|
8
|
+
:style="{ transform: `translate3d(0,${translateY}px,0)` }"
|
|
9
|
+
@touchstart="_onTouchStart"
|
|
10
|
+
@touchmove="_onTouchMove"
|
|
11
|
+
@touchend="_onTouchEnd"
|
|
12
|
+
>
|
|
13
|
+
<!-- 上方占位 -->
|
|
14
|
+
<li :style="{ height: height + 'px' }" />
|
|
15
|
+
<li :style="{ height: height + 'px' }" />
|
|
16
|
+
|
|
17
|
+
<!-- 数据列表 -->
|
|
18
|
+
<li
|
|
19
|
+
v-for="(item, index) in list"
|
|
20
|
+
:key="index"
|
|
21
|
+
:class="{
|
|
22
|
+
current: index === current.index,
|
|
23
|
+
level_1_1: index - current.index === 1,
|
|
24
|
+
level_2_1: index - current.index === 2,
|
|
25
|
+
level_3_1: index - current.index >= 3,
|
|
26
|
+
level_1: index - current.index === -1,
|
|
27
|
+
level_2: index - current.index === -2,
|
|
28
|
+
level_3: index - current.index <= -3
|
|
29
|
+
}"
|
|
30
|
+
:style="{ textAlign: align, height: height + 'px' }"
|
|
31
|
+
>
|
|
32
|
+
{{ item.value }}
|
|
33
|
+
</li>
|
|
34
|
+
|
|
35
|
+
<!-- 下方占位 -->
|
|
36
|
+
<li :style="{ height: height + 'px' }" />
|
|
37
|
+
<li :style="{ height: height + 'px' }" />
|
|
38
|
+
</ul>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { defineComponent, ref, computed, watch, onMounted } from 'vue'
|
|
44
|
+
|
|
45
|
+
export default defineComponent({
|
|
46
|
+
name: 'PickerSlot',
|
|
47
|
+
props: {
|
|
48
|
+
styles: Object,
|
|
49
|
+
list: {
|
|
50
|
+
type: Array,
|
|
51
|
+
default: () => []
|
|
52
|
+
},
|
|
53
|
+
align: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'center'
|
|
56
|
+
},
|
|
57
|
+
target: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
initItem: {
|
|
62
|
+
type: [String, Number],
|
|
63
|
+
default: ''
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
setup (props, { emit }) {
|
|
67
|
+
const count = 7
|
|
68
|
+
const height = ref(35)
|
|
69
|
+
const current = ref({})
|
|
70
|
+
const translateY = ref(0)
|
|
71
|
+
const currentTranslateY = ref(0)
|
|
72
|
+
const dragging = ref(false)
|
|
73
|
+
const startX = ref(0)
|
|
74
|
+
const startY = ref(0)
|
|
75
|
+
const delta = ref({ x: 0, y: 0 })
|
|
76
|
+
|
|
77
|
+
const classes = computed(() => ['dpzvc3-picker-slot'])
|
|
78
|
+
const draggingClass = computed(() => ({
|
|
79
|
+
'dpzvc3-picker-slot-dragging': dragging.value
|
|
80
|
+
}))
|
|
81
|
+
|
|
82
|
+
const wrapperHeight = computed(() => count * height.value)
|
|
83
|
+
|
|
84
|
+
const getStyles = ref({})
|
|
85
|
+
const updateStyles = () => {
|
|
86
|
+
const styles = { ...props.styles }
|
|
87
|
+
if (styles.height) {
|
|
88
|
+
height.value = styles.height / count
|
|
89
|
+
}
|
|
90
|
+
getStyles.value = { ...styles, height: wrapperHeight.value + 'px' }
|
|
91
|
+
}
|
|
92
|
+
const getSelectedIndex = () => {
|
|
93
|
+
const maxIndex = props.list.length - 1
|
|
94
|
+
let index = -Math.round(currentTranslateY.value / height.value)
|
|
95
|
+
index = Math.max(index, 0)
|
|
96
|
+
index = Math.min(index, maxIndex)
|
|
97
|
+
return index
|
|
98
|
+
}
|
|
99
|
+
// 初始化样式
|
|
100
|
+
updateStyles()
|
|
101
|
+
|
|
102
|
+
watch(
|
|
103
|
+
() => props.styles,
|
|
104
|
+
() => {
|
|
105
|
+
updateStyles()
|
|
106
|
+
},
|
|
107
|
+
{ deep: true }
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
// list 数据变化
|
|
111
|
+
watch(
|
|
112
|
+
() => props.list,
|
|
113
|
+
(list) => {
|
|
114
|
+
if (list.length) {
|
|
115
|
+
let index = getSelectedIndex()
|
|
116
|
+
if (index > list.length - 1) index = 0
|
|
117
|
+
current.value = { ...current.value, ...list[index] }
|
|
118
|
+
emit('change', props.target, current.value)
|
|
119
|
+
} else {
|
|
120
|
+
translateY.value = 0
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{ immediate: true }
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
const setSelectedItem = (index) => {
|
|
127
|
+
translateY.value = currentTranslateY.value = -index * height.value
|
|
128
|
+
try {
|
|
129
|
+
if (
|
|
130
|
+
current.value.code === props.list[index].code &&
|
|
131
|
+
current.value.value === props.list[index].value
|
|
132
|
+
) {
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
current.value = {
|
|
136
|
+
code: props.list[index].code,
|
|
137
|
+
value: props.list[index].value,
|
|
138
|
+
target: props.target,
|
|
139
|
+
index
|
|
140
|
+
}
|
|
141
|
+
} catch (e) {
|
|
142
|
+
current.value = { code: '', value: '', target: props.target, index: '' }
|
|
143
|
+
}
|
|
144
|
+
emit('change', props.target, current.value)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const scrollToItem = (code) => {
|
|
148
|
+
props.list.forEach((item, i) => {
|
|
149
|
+
if (item.code === code) {
|
|
150
|
+
currentTranslateY.value = translateY.value
|
|
151
|
+
setSelectedItem(i)
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const _onTouchStart = (e) => {
|
|
157
|
+
e.preventDefault()
|
|
158
|
+
e.stopPropagation()
|
|
159
|
+
currentTranslateY.value = translateY.value
|
|
160
|
+
startX.value = e.touches[0].pageX
|
|
161
|
+
startY.value = e.touches[0].pageY
|
|
162
|
+
dragging.value = true
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const _onTouchMove = (e) => {
|
|
166
|
+
e.preventDefault()
|
|
167
|
+
e.stopPropagation()
|
|
168
|
+
delta.value.x = e.touches[0].pageX - startX.value
|
|
169
|
+
delta.value.y = e.touches[0].pageY - startY.value
|
|
170
|
+
translateY.value = delta.value.y + currentTranslateY.value
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const _onTouchEnd = (e) => {
|
|
174
|
+
e.preventDefault()
|
|
175
|
+
e.stopPropagation()
|
|
176
|
+
dragging.value = false
|
|
177
|
+
currentTranslateY.value = translateY.value
|
|
178
|
+
const index = getSelectedIndex()
|
|
179
|
+
setSelectedItem(index)
|
|
180
|
+
}
|
|
181
|
+
// initItem 变化
|
|
182
|
+
watch(
|
|
183
|
+
() => props.initItem,
|
|
184
|
+
(value) => {
|
|
185
|
+
if (value === '' || value === null) {
|
|
186
|
+
current.value = { code: '', target: props.target, index: '', value: '' }
|
|
187
|
+
emit('change', props.target, current.value)
|
|
188
|
+
} else {
|
|
189
|
+
scrollToItem(value)
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{ immediate: true }
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
onMounted(() => {
|
|
196
|
+
if (!props.initItem && props.initItem !== 0) {
|
|
197
|
+
current.value = { code: '', target: props.target, index: '', value: '' }
|
|
198
|
+
emit('change', props.target, current.value)
|
|
199
|
+
} else {
|
|
200
|
+
scrollToItem(props.initItem)
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
return {
|
|
204
|
+
classes,
|
|
205
|
+
draggingClass,
|
|
206
|
+
translateY,
|
|
207
|
+
height,
|
|
208
|
+
current,
|
|
209
|
+
_onTouchStart,
|
|
210
|
+
_onTouchMove,
|
|
211
|
+
_onTouchEnd,
|
|
212
|
+
getStyles,
|
|
213
|
+
getSelectedIndex
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Popup
|
|
3
|
+
v-model="visible"
|
|
4
|
+
height="284px"
|
|
5
|
+
position="bottom"
|
|
6
|
+
>
|
|
7
|
+
<div :class="wrapperClass">
|
|
8
|
+
<div :class="contentClass">
|
|
9
|
+
<AreaPicker
|
|
10
|
+
v-if="type === 'AreaPicker'"
|
|
11
|
+
:styles="styles"
|
|
12
|
+
:value-separator="valueSeparator"
|
|
13
|
+
:address-value="addressValue"
|
|
14
|
+
@ok="onOk"
|
|
15
|
+
@fail="onFail"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<DatePicker
|
|
19
|
+
v-if="type === 'DatePicker'"
|
|
20
|
+
:year="year"
|
|
21
|
+
:month="month"
|
|
22
|
+
:day="day"
|
|
23
|
+
:value-separator="valueSeparator"
|
|
24
|
+
:date-value="dateValue"
|
|
25
|
+
@ok="onOk"
|
|
26
|
+
@fail="onFail"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<NormalPicker
|
|
30
|
+
v-if="type === 'NormalPicker'"
|
|
31
|
+
:list="list"
|
|
32
|
+
:init-arr="initArr"
|
|
33
|
+
@ok="onOk"
|
|
34
|
+
@fail="onFail"
|
|
35
|
+
@scroll="onNormalChange"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</Popup>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { defineComponent, ref, watch, computed, provide } from 'vue'
|
|
44
|
+
import Popup from '../popup'
|
|
45
|
+
import AreaPicker from './area-picker/area-picker.vue'
|
|
46
|
+
import DatePicker from './date-picker/date-picker.vue'
|
|
47
|
+
import NormalPicker from './normal-picker/normal-picker.vue'
|
|
48
|
+
import areaProps from './area-picker/props'
|
|
49
|
+
import dateProps from './date-picker/props'
|
|
50
|
+
import normalProps from './normal-picker/props'
|
|
51
|
+
|
|
52
|
+
const LIST = ['DatePicker', 'AreaPicker', 'NormalPicker']
|
|
53
|
+
const prefixCls = 'dpzvc3-picker'
|
|
54
|
+
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: 'Dpzvc3Picker',
|
|
57
|
+
components: { Popup, AreaPicker, DatePicker, NormalPicker },
|
|
58
|
+
mixins: [areaProps, dateProps, normalProps],
|
|
59
|
+
props: {
|
|
60
|
+
type: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'DatePicker',
|
|
63
|
+
validator: (val) => LIST.includes(val)
|
|
64
|
+
},
|
|
65
|
+
modelValue: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
emits: ['update:modelValue', 'sure', 'cancle', 'normal-change'],
|
|
71
|
+
setup (props, { emit }) {
|
|
72
|
+
const visible = ref(props.value)
|
|
73
|
+
watch(() => props.modelValue, (val) => {
|
|
74
|
+
visible.value = val
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
watch(visible, (val) => {
|
|
78
|
+
emit('update:value', val)
|
|
79
|
+
})
|
|
80
|
+
const wrapperClass = computed(() => [`${prefixCls}-wrapper`])
|
|
81
|
+
const contentClass = computed(() => [`${prefixCls}-content`])
|
|
82
|
+
|
|
83
|
+
const onOk = (val) => {
|
|
84
|
+
emit('update:modelValue', false)
|
|
85
|
+
emit('sure', val)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const onFail = () => {
|
|
89
|
+
emit('update:modelValue', false)
|
|
90
|
+
emit('cancle')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const onNormalChange = (val) => {
|
|
94
|
+
emit('normal-change', val)
|
|
95
|
+
}
|
|
96
|
+
provide('DpzVc3Picker', {
|
|
97
|
+
pickerOnOk: onOk,
|
|
98
|
+
pickeronFail: onFail,
|
|
99
|
+
pickerOnNormalChange: onNormalChange
|
|
100
|
+
})
|
|
101
|
+
return {
|
|
102
|
+
visible,
|
|
103
|
+
wrapperClass,
|
|
104
|
+
contentClass,
|
|
105
|
+
onOk,
|
|
106
|
+
onFail,
|
|
107
|
+
onNormalChange
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes">
|
|
3
|
+
<transition name="dpzvc3-ani-fade">
|
|
4
|
+
<div
|
|
5
|
+
v-if="mask && visible"
|
|
6
|
+
class="dpzvc3-popup-mask"
|
|
7
|
+
@click="close"
|
|
8
|
+
@touchmove.prevent
|
|
9
|
+
/>
|
|
10
|
+
</transition>
|
|
11
|
+
<transition :name="'dpzvc3-ani-' + position">
|
|
12
|
+
<div
|
|
13
|
+
v-if="visible"
|
|
14
|
+
:class="popupClasses"
|
|
15
|
+
:style="contentStyle"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</transition>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { ref, computed, watch } from 'vue'
|
|
25
|
+
|
|
26
|
+
const prefixCls = 'dpzvc3-popup'
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'Dpzvc3Popup',
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: { // Vue 3 v-model 默认绑定
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
position: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'bottom',
|
|
38
|
+
validator: (val) => ['top', 'bottom', 'center'].includes(val)
|
|
39
|
+
},
|
|
40
|
+
showMask: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
44
|
+
maskClosable: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
width: {
|
|
49
|
+
type: [Number, String],
|
|
50
|
+
default: '100%'
|
|
51
|
+
},
|
|
52
|
+
height: {
|
|
53
|
+
type: [Number, String]
|
|
54
|
+
},
|
|
55
|
+
styles: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: () => ({})
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
setup (props, { emit }) {
|
|
61
|
+
const visible = ref(props.modelValue)
|
|
62
|
+
const mask = ref(props.showMask)
|
|
63
|
+
|
|
64
|
+
// 同步 props -> 状态
|
|
65
|
+
watch(() => props.modelValue, (val) => { visible.value = val })
|
|
66
|
+
watch(visible, (val) => { emit('update:modelValue', val) })
|
|
67
|
+
|
|
68
|
+
watch(() => props.showMask, (val) => { mask.value = val })
|
|
69
|
+
|
|
70
|
+
const classes = computed(() => [prefixCls])
|
|
71
|
+
const popupClasses = computed(() => [`${prefixCls}-${props.position}`, `${prefixCls}-content`])
|
|
72
|
+
const contentStyle = computed(() => {
|
|
73
|
+
const heightValue = props.height != null ? props.height : (props.position === 'top' ? 'auto' : '100%')
|
|
74
|
+
return { ...props.styles, width: props.width, height: heightValue }
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const close = () => {
|
|
78
|
+
if (props.maskClosable && mask.value) visible.value = false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
visible,
|
|
83
|
+
mask,
|
|
84
|
+
classes,
|
|
85
|
+
popupClasses,
|
|
86
|
+
contentStyle,
|
|
87
|
+
close
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="classes"
|
|
4
|
+
:style="styles"
|
|
5
|
+
>
|
|
6
|
+
<slot name="left" />
|
|
7
|
+
|
|
8
|
+
<div :class="outerClass">
|
|
9
|
+
<div
|
|
10
|
+
:class="runawayClass"
|
|
11
|
+
:style="runawayStyle"
|
|
12
|
+
/>
|
|
13
|
+
<div
|
|
14
|
+
:class="progressClass"
|
|
15
|
+
:style="progressStyle"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<slot name="right" />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { defineComponent, ref, computed, watch } from 'vue'
|
|
25
|
+
|
|
26
|
+
const prefixCls = 'dpzvc3-progress'
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
name: 'DpzVcProgress',
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
styles: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
},
|
|
36
|
+
modelValue: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: 0
|
|
39
|
+
},
|
|
40
|
+
barHeight: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: 3
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
setup (props) {
|
|
47
|
+
/** 当前进度宽度 */
|
|
48
|
+
const width = ref(Number(props.modelValue) || 0)
|
|
49
|
+
|
|
50
|
+
/** 同步外部 value */
|
|
51
|
+
watch(
|
|
52
|
+
() => props.modelValue,
|
|
53
|
+
val => {
|
|
54
|
+
const num = Number(val) || 0
|
|
55
|
+
width.value = num >= 100 ? 100 : num
|
|
56
|
+
},
|
|
57
|
+
{ immediate: true }
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
/** classes */
|
|
61
|
+
const classes = computed(() => [prefixCls])
|
|
62
|
+
const outerClass = computed(() => [`${prefixCls}-outer`])
|
|
63
|
+
const runawayClass = computed(() => [`${prefixCls}-runaway`])
|
|
64
|
+
const progressClass = computed(() => [`${prefixCls}-progress`])
|
|
65
|
+
|
|
66
|
+
/** styles */
|
|
67
|
+
const runawayStyle = computed(() => ({
|
|
68
|
+
height: `${props.barHeight}px`
|
|
69
|
+
}))
|
|
70
|
+
|
|
71
|
+
const progressStyle = computed(() => ({
|
|
72
|
+
height: `${props.barHeight}px`,
|
|
73
|
+
width: `${width.value}%`
|
|
74
|
+
}))
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
classes,
|
|
78
|
+
outerClass,
|
|
79
|
+
runawayClass,
|
|
80
|
+
progressClass,
|
|
81
|
+
runawayStyle,
|
|
82
|
+
progressStyle
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 3 prompt confirm
|
|
3
|
+
* 使用 createVNode + render
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { createVNode, render } from 'vue'
|
|
7
|
+
import Prompt from './prompt.vue'
|
|
8
|
+
|
|
9
|
+
// let seed = 0
|
|
10
|
+
|
|
11
|
+
Prompt.newInstance = (properties = {}) => {
|
|
12
|
+
// const id = `dpzvc3-prompt-${seed++}`
|
|
13
|
+
const instance = null
|
|
14
|
+
// 容器
|
|
15
|
+
const container = document.createElement('div')
|
|
16
|
+
// container.id = id
|
|
17
|
+
document.body.appendChild(container)
|
|
18
|
+
// 组件 props(默认值)
|
|
19
|
+
const props = {
|
|
20
|
+
value: false,
|
|
21
|
+
text: '',
|
|
22
|
+
placeholderText: '请输入',
|
|
23
|
+
width: '70%',
|
|
24
|
+
title: '',
|
|
25
|
+
okText: '确定',
|
|
26
|
+
cancleText: '取消',
|
|
27
|
+
loading: false,
|
|
28
|
+
showCancle: true,
|
|
29
|
+
spec: '',
|
|
30
|
+
message: '',
|
|
31
|
+
validator: null,
|
|
32
|
+
onOk: () => {},
|
|
33
|
+
onCancle: () => {},
|
|
34
|
+
...properties
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const updateVNode = () => {
|
|
38
|
+
// vnode
|
|
39
|
+
// console.log(props, 'props')
|
|
40
|
+
const vnode = createVNode(Prompt, {
|
|
41
|
+
...props,
|
|
42
|
+
// 给动态挂载组件绑定 update:value 事件
|
|
43
|
+
'onUpdate:value': (val) => {
|
|
44
|
+
// 当子组件 emit('update:value', false) 时执行
|
|
45
|
+
if (val === false) {
|
|
46
|
+
vnode.component.props.value = false // 关闭内部显示
|
|
47
|
+
destroy() // 销毁 DOM
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
onRemove: destroy
|
|
51
|
+
})
|
|
52
|
+
// 挂载
|
|
53
|
+
render(vnode, container)
|
|
54
|
+
// instance = vnode.component
|
|
55
|
+
}
|
|
56
|
+
// 销毁
|
|
57
|
+
const destroy = () => {
|
|
58
|
+
props.value = false
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
render(null, container)
|
|
61
|
+
}, 300)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
/**
|
|
66
|
+
* 显示
|
|
67
|
+
*/
|
|
68
|
+
show (options = {}) {
|
|
69
|
+
// alert(1)
|
|
70
|
+
Object.keys(options).forEach(key => {
|
|
71
|
+
props[key] = options[key]
|
|
72
|
+
})
|
|
73
|
+
// console.log(instance.props, 'props')
|
|
74
|
+
props.value = true
|
|
75
|
+
updateVNode()
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 关闭
|
|
80
|
+
*/
|
|
81
|
+
remove () {
|
|
82
|
+
props.value = false
|
|
83
|
+
|
|
84
|
+
destroy()
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
component: instance
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default Prompt
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by admin on 2025/12/10.
|
|
3
|
+
* Rewritten for Vue 3 (no createApp)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Prompt from './confirm'
|
|
7
|
+
|
|
8
|
+
let promptInstance = null
|
|
9
|
+
|
|
10
|
+
function getPromptInstance () {
|
|
11
|
+
if (!promptInstance) {
|
|
12
|
+
promptInstance = Prompt.newInstance({
|
|
13
|
+
closable: true,
|
|
14
|
+
maskClosable: false,
|
|
15
|
+
footerHide: false
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
return promptInstance
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* confirm 核心方法
|
|
23
|
+
*/
|
|
24
|
+
function confirm (options = {}) {
|
|
25
|
+
const instance = getPromptInstance()
|
|
26
|
+
|
|
27
|
+
// 组件销毁回调
|
|
28
|
+
options.onRemove = () => {
|
|
29
|
+
promptInstance = null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
instance.show(options)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* info 弹窗
|
|
37
|
+
*/
|
|
38
|
+
Prompt.info = function (props = {}) {
|
|
39
|
+
props.showCancle = true
|
|
40
|
+
return confirm(props)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 手动关闭
|
|
45
|
+
*/
|
|
46
|
+
Prompt.remove = function () {
|
|
47
|
+
if (!promptInstance) return
|
|
48
|
+
|
|
49
|
+
const instance = getPromptInstance()
|
|
50
|
+
instance.remove()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default Prompt
|