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.
Files changed (268) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +175 -0
  3. package/build-style.js +58 -0
  4. package/dist/dpzvc3.esm.js +17676 -0
  5. package/dist/dpzvc3.esm.js.map +1 -0
  6. package/dist/dpzvc3.esm.min.js +2 -0
  7. package/dist/dpzvc3.esm.min.js.map +1 -0
  8. package/dist/dpzvc3.js +15200 -0
  9. package/dist/dpzvc3.js.map +1 -0
  10. package/dist/dpzvc3.min.js +2 -0
  11. package/dist/dpzvc3.min.js.map +1 -0
  12. package/dist/styles/base/font.css +1 -0
  13. package/dist/styles/base/reset.css +1 -0
  14. package/dist/styles/base/variable.css +0 -0
  15. package/dist/styles/components/actionSheet.css +1 -0
  16. package/dist/styles/components/badge.css +1 -0
  17. package/dist/styles/components/button.css +1 -0
  18. package/dist/styles/components/card.css +1 -0
  19. package/dist/styles/components/cell-swipe.css +1 -0
  20. package/dist/styles/components/cell.css +1 -0
  21. package/dist/styles/components/checkBox.css +1 -0
  22. package/dist/styles/components/editor.css +1 -0
  23. package/dist/styles/components/header.css +1 -0
  24. package/dist/styles/components/indicator.css +1 -0
  25. package/dist/styles/components/loadmore.css +1 -0
  26. package/dist/styles/components/message.css +1 -0
  27. package/dist/styles/components/modal.css +1 -0
  28. package/dist/styles/components/number.css +1 -0
  29. package/dist/styles/components/picker.css +1 -0
  30. package/dist/styles/components/popup.css +1 -0
  31. package/dist/styles/components/progress.css +1 -0
  32. package/dist/styles/components/prompt.css +1 -0
  33. package/dist/styles/components/radioBox.css +1 -0
  34. package/dist/styles/components/slide-Bar.css +1 -0
  35. package/dist/styles/components/spinner.css +1 -0
  36. package/dist/styles/components/swipe.css +1 -0
  37. package/dist/styles/components/switchBar.css +1 -0
  38. package/dist/styles/components/tab.css +1 -0
  39. package/dist/styles/components/text.css +1 -0
  40. package/dist/styles/components/toTop.css +1 -0
  41. package/dist/styles/components/upload.css +1 -0
  42. package/dist/styles/dpzvc3.css +1 -0
  43. package/dist/styles/utils/1px.css +1 -0
  44. package/dist/styles/utils/animation.css +1 -0
  45. package/dist/styles/utils/nowrap.css +1 -0
  46. package/dist-prod/91.9d79b442ec3131707419.js +3 -0
  47. package/dist-prod/91.9d79b442ec3131707419.js.LICENSE.txt +25 -0
  48. package/dist-prod/91.9d79b442ec3131707419.js.map +1 -0
  49. package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js +2 -0
  50. package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js.map +1 -0
  51. package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js +2 -0
  52. package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js.map +1 -0
  53. package/dist-prod/button.28b491339fbba29c3f16.chunk.js +2 -0
  54. package/dist-prod/button.28b491339fbba29c3f16.chunk.js.map +1 -0
  55. package/dist-prod/card.3ad847f07bebc1391125.chunk.js +2 -0
  56. package/dist-prod/card.3ad847f07bebc1391125.chunk.js.map +1 -0
  57. package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js +2 -0
  58. package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js.map +1 -0
  59. package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js +2 -0
  60. package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js.map +1 -0
  61. package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js +2 -0
  62. package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js.map +1 -0
  63. package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js +2 -0
  64. package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js.map +1 -0
  65. package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js +2 -0
  66. package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js.map +1 -0
  67. package/dist-prod/index.html +19 -0
  68. package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js +2 -0
  69. package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js.map +1 -0
  70. package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js +2 -0
  71. package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js.map +1 -0
  72. package/dist-prod/main.2e9aaa9095e329ea2d7b.js +2 -0
  73. package/dist-prod/main.2e9aaa9095e329ea2d7b.js.map +1 -0
  74. package/dist-prod/message.e57fa263a214006f7191.chunk.js +2 -0
  75. package/dist-prod/message.e57fa263a214006f7191.chunk.js.map +1 -0
  76. package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js +2 -0
  77. package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js.map +1 -0
  78. package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js +2 -0
  79. package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js.map +1 -0
  80. package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js +2 -0
  81. package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js.map +1 -0
  82. package/dist-prod/progress.1e0d785044aecadc5615.chunk.js +2 -0
  83. package/dist-prod/progress.1e0d785044aecadc5615.chunk.js.map +1 -0
  84. package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js +2 -0
  85. package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js.map +1 -0
  86. package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js +2 -0
  87. package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js.map +1 -0
  88. package/dist-prod/rater.939e0e7e770728f684c3.chunk.js +2 -0
  89. package/dist-prod/rater.939e0e7e770728f684c3.chunk.js.map +1 -0
  90. package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js +2 -0
  91. package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js.map +1 -0
  92. package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js +2 -0
  93. package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js.map +1 -0
  94. package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js +2 -0
  95. package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js.map +1 -0
  96. package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js +2 -0
  97. package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js.map +1 -0
  98. package/dist-prod/tab.4c391211c41b7d12b585.chunk.js +2 -0
  99. package/dist-prod/tab.4c391211c41b7d12b585.chunk.js.map +1 -0
  100. package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js +2 -0
  101. package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js.map +1 -0
  102. package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js +2 -0
  103. package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js.map +1 -0
  104. package/dist-prod/upload.ec7a954970889869d93e.chunk.js +2 -0
  105. package/dist-prod/upload.ec7a954970889869d93e.chunk.js.map +1 -0
  106. package/images/IMG_2614 2 2.JPG +0 -0
  107. package/images/IMG_2614.JPG +0 -0
  108. package/images/IMG_2615 2.JPG +0 -0
  109. package/images/IMG_2615.JPG +0 -0
  110. package/package.json +113 -0
  111. package/postcss.config.js +5 -0
  112. package/src/components/Indicator/Indicator.vue +82 -0
  113. package/src/components/Indicator/index.js +86 -0
  114. package/src/components/Text/Number.vue +167 -0
  115. package/src/components/Text/index.js +7 -0
  116. package/src/components/Text/textBar.vue +122 -0
  117. package/src/components/action-sheet/actionSheet.vue +93 -0
  118. package/src/components/action-sheet/index.js +5 -0
  119. package/src/components/app.vue +61 -0
  120. package/src/components/badge/badge.vue +80 -0
  121. package/src/components/badge/index.js +5 -0
  122. package/src/components/button/button.vue +111 -0
  123. package/src/components/button/index.js +5 -0
  124. package/src/components/card/card.vue +49 -0
  125. package/src/components/card/index.js +5 -0
  126. package/src/components/cell/cell.vue +93 -0
  127. package/src/components/cell/index.js +5 -0
  128. package/src/components/cell-swipe/cell-swipe.vue +169 -0
  129. package/src/components/cell-swipe/index.js +5 -0
  130. package/src/components/checkBox/checkbox-group.vue +74 -0
  131. package/src/components/checkBox/checkbox.vue +117 -0
  132. package/src/components/checkBox/index.js +8 -0
  133. package/src/components/header/header.vue +130 -0
  134. package/src/components/header/index.js +5 -0
  135. package/src/components/loadMore/index.js +5 -0
  136. package/src/components/loadMore/loadmore.vue +258 -0
  137. package/src/components/message/confirm.js +60 -0
  138. package/src/components/message/index.js +111 -0
  139. package/src/components/message/message.vue +137 -0
  140. package/src/components/message/messageGroup.vue +82 -0
  141. package/src/components/modal/confirm.js +122 -0
  142. package/src/components/modal/index.js +52 -0
  143. package/src/components/modal/modal.vue +138 -0
  144. package/src/components/picker/area-picker/area-picker.vue +230 -0
  145. package/src/components/picker/area-picker/props.js +17 -0
  146. package/src/components/picker/date-picker/date-picker.vue +191 -0
  147. package/src/components/picker/date-picker/props.js +24 -0
  148. package/src/components/picker/index.js +5 -0
  149. package/src/components/picker/normal-picker/normal-picker.vue +120 -0
  150. package/src/components/picker/normal-picker/props.js +20 -0
  151. package/src/components/picker/picker-slot.vue +217 -0
  152. package/src/components/picker/picker.vue +111 -0
  153. package/src/components/popup/index.js +5 -0
  154. package/src/components/popup/popup.vue +91 -0
  155. package/src/components/progress/index.js +5 -0
  156. package/src/components/progress/progress.vue +86 -0
  157. package/src/components/prompt/confirm.js +91 -0
  158. package/src/components/prompt/index.js +53 -0
  159. package/src/components/prompt/prompt.vue +125 -0
  160. package/src/components/radioBox/index.js +8 -0
  161. package/src/components/radioBox/radiobox-group.vue +66 -0
  162. package/src/components/radioBox/radiobox.vue +88 -0
  163. package/src/components/rater/index.js +5 -0
  164. package/src/components/rater/rater.vue +118 -0
  165. package/src/components/slideBar/index.js +6 -0
  166. package/src/components/slideBar/slideBar.vue +207 -0
  167. package/src/components/spinner/behavior/blade.vue +42 -0
  168. package/src/components/spinner/behavior/double-bounce.vue +38 -0
  169. package/src/components/spinner/behavior/fading-circle.vue +55 -0
  170. package/src/components/spinner/behavior/snake.vue +41 -0
  171. package/src/components/spinner/behavior/triple-bounce.vue +52 -0
  172. package/src/components/spinner/index.js +5 -0
  173. package/src/components/spinner/props.js +28 -0
  174. package/src/components/spinner/spinner.vue +78 -0
  175. package/src/components/swipe/index.js +5 -0
  176. package/src/components/swipe/swipe.vue +281 -0
  177. package/src/components/switchbar/index.js +5 -0
  178. package/src/components/switchbar/switchbar.vue +79 -0
  179. package/src/components/tab/index.js +6 -0
  180. package/src/components/tab/tab.vue +89 -0
  181. package/src/components/toTop/index.js +5 -0
  182. package/src/components/toTop/topTop.vue +78 -0
  183. package/src/components/upload/index.js +5 -0
  184. package/src/components/upload/upload.vue +166 -0
  185. package/src/config/config.js +16 -0
  186. package/src/directives/clickoutside.js +42 -0
  187. package/src/directives/tranferDom.js +66 -0
  188. package/src/index.js +149 -0
  189. package/src/lib/MegaPixImage.js +163 -0
  190. package/src/lib/MegaPixImageOld.js +153 -0
  191. package/src/lib/exif-js.js +235 -0
  192. package/src/lib/exif.js +789 -0
  193. package/src/main.js +31 -0
  194. package/src/mixin/emitter.js +72 -0
  195. package/src/mixin/input.js +41 -0
  196. package/src/router.js +36 -0
  197. package/src/styles/base/font.less +99 -0
  198. package/src/styles/base/reset.less +135 -0
  199. package/src/styles/base/variable.less +108 -0
  200. package/src/styles/components/actionSheet.less +43 -0
  201. package/src/styles/components/badge.less +81 -0
  202. package/src/styles/components/button.less +124 -0
  203. package/src/styles/components/card.less +31 -0
  204. package/src/styles/components/cell-swipe.less +20 -0
  205. package/src/styles/components/cell.less +75 -0
  206. package/src/styles/components/checkBox.less +113 -0
  207. package/src/styles/components/editor.less +3 -0
  208. package/src/styles/components/header.less +72 -0
  209. package/src/styles/components/indicator.less +39 -0
  210. package/src/styles/components/loadmore.less +48 -0
  211. package/src/styles/components/message.less +57 -0
  212. package/src/styles/components/modal.less +84 -0
  213. package/src/styles/components/number.less +60 -0
  214. package/src/styles/components/picker.less +152 -0
  215. package/src/styles/components/popup.less +46 -0
  216. package/src/styles/components/progress.less +52 -0
  217. package/src/styles/components/prompt.less +37 -0
  218. package/src/styles/components/radioBox.less +138 -0
  219. package/src/styles/components/slide-Bar.less +149 -0
  220. package/src/styles/components/spinner.less +329 -0
  221. package/src/styles/components/swipe.less +125 -0
  222. package/src/styles/components/switchBar.less +88 -0
  223. package/src/styles/components/tab.less +71 -0
  224. package/src/styles/components/text.less +82 -0
  225. package/src/styles/components/toTop.less +28 -0
  226. package/src/styles/components/upload.less +23 -0
  227. package/src/styles/index.less +38 -0
  228. package/src/styles/utils/1px.less +206 -0
  229. package/src/styles/utils/animation.less +165 -0
  230. package/src/styles/utils/nowrap.less +19 -0
  231. package/src/template/index.ejs +40 -0
  232. package/src/utils/util.js +202 -0
  233. package/src/vconsole-resources.min.js +6 -0
  234. package/src/vconsole-sources.min.js +6 -0
  235. package/src/vconsole.min.js +7 -0
  236. package/src/views/ActionSheet.vue +46 -0
  237. package/src/views/Badge.vue +51 -0
  238. package/src/views/Button.vue +69 -0
  239. package/src/views/Card.vue +88 -0
  240. package/src/views/Cell.vue +30 -0
  241. package/src/views/CellSwipe.vue +68 -0
  242. package/src/views/CheckBox.vue +77 -0
  243. package/src/views/Header.vue +70 -0
  244. package/src/views/Indicator.vue +82 -0
  245. package/src/views/LoadMore.vue +73 -0
  246. package/src/views/Message.vue +61 -0
  247. package/src/views/Modal.vue +69 -0
  248. package/src/views/Picker.vue +140 -0
  249. package/src/views/Popup.vue +97 -0
  250. package/src/views/Progress.vue +47 -0
  251. package/src/views/Prompt.vue +43 -0
  252. package/src/views/RadioBox.vue +68 -0
  253. package/src/views/Rater.vue +49 -0
  254. package/src/views/SlideBar.vue +55 -0
  255. package/src/views/Spinner.vue +15 -0
  256. package/src/views/Swipe.vue +59 -0
  257. package/src/views/SwitchBar.vue +47 -0
  258. package/src/views/Tab.vue +53 -0
  259. package/src/views/Text.vue +93 -0
  260. package/src/views/ToTop.vue +17 -0
  261. package/src/views/Upload.vue +61 -0
  262. package/src/views/guide.vue +164 -0
  263. package/src/views/index.vue +554 -0
  264. package/webpack.base.config.js +65 -0
  265. package/webpack.dev.config.js +42 -0
  266. package/webpack.dist.dev.config.js +75 -0
  267. package/webpack.dist.prod.config.js +89 -0
  268. package/webpack.prod.config.js +51 -0
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <label :class="classes">
3
+ <span :class="wrapperClasses">
4
+ <span :class="innerClasses" />
5
+ <input
6
+ type="checkbox"
7
+ class="dpzvc3-checkbox-input noselect"
8
+ :disabled="disable"
9
+ :checked="currentValue"
10
+ @change="change"
11
+ >
12
+ </span>
13
+ <slot v-if="show">
14
+ <span ref="slotRef">{{ label }}</span>
15
+ </slot>
16
+ </label>
17
+ </template>
18
+
19
+ <script>
20
+ import {
21
+ defineComponent,
22
+ ref,
23
+ computed,
24
+ inject,
25
+ watch,
26
+ onMounted
27
+ } from 'vue'
28
+
29
+ export default defineComponent({
30
+ name: 'CheckBox',
31
+
32
+ props: {
33
+ disable: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ modelValue: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ label: {
42
+ type: [String, Number, Boolean]
43
+ }
44
+ },
45
+
46
+ emits: ['update:modelValue', 'on-change'],
47
+
48
+ setup (props, { emit }) {
49
+ // 注入 checkboxGroup(由 CheckBoxGroup provide)
50
+ const checkboxGroup = inject('CheckBoxGroup')
51
+ // console.log(checkboxGroup, 'checkboxGroup')
52
+ const isGroup = ref(!!checkboxGroup)
53
+ const currentValue = ref(props.modelValue)
54
+ const show = ref(true)
55
+ const slotRef = ref(null)
56
+
57
+ const classes = computed(() => ['dpzvc3-checkbox'])
58
+
59
+ const wrapperClasses = computed(() => [
60
+ 'dpzvc3-checkbox-wrapper',
61
+ {
62
+ 'dpzvc3-checkbox-checked': currentValue.value,
63
+ 'dpzvc3-checkbox-disable': props.disable
64
+ }
65
+ ])
66
+
67
+ const innerClasses = computed(() => ['dpzvc3-checkbox-inner'])
68
+
69
+ watch(
70
+ () => props.modelValue,
71
+ val => {
72
+ currentValue.value = val
73
+ }
74
+ )
75
+
76
+ const change = (e) => {
77
+ if (props.disable) return
78
+ const checked = e.target.checked
79
+ currentValue.value = checked
80
+
81
+ // group 模式
82
+ if (isGroup.value && checkboxGroup) {
83
+ const value = [...checkboxGroup.currentValue.value]
84
+ const index = value.indexOf(props.label)
85
+
86
+ if (checked && index === -1) value.push(props.label)
87
+ if (!checked && index > -1) value.splice(index, 1)
88
+ checkboxGroup.toggleOption(value)
89
+ } else {
90
+ emit('update:modelValue', checked)
91
+ emit('on-change', checked)
92
+ }
93
+ }
94
+
95
+ onMounted(() => {
96
+ if (isGroup.value && checkboxGroup) {
97
+ const value = [...checkboxGroup.currentValue.value]
98
+ const index = value.indexOf(props.label)
99
+ if (index !== -1) currentValue.value = true
100
+ }
101
+ if (slotRef.value && !slotRef.value.innerHTML) {
102
+ show.value = false
103
+ }
104
+ })
105
+
106
+ return {
107
+ slotRef,
108
+ show,
109
+ currentValue,
110
+ classes,
111
+ wrapperClasses,
112
+ innerClasses,
113
+ change
114
+ }
115
+ }
116
+ })
117
+ </script>
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Created by admin on 2017/4/19.
3
+ */
4
+ import CheckBox from './checkbox.vue'
5
+ import CheckGroup from './checkbox-group.vue'
6
+
7
+ CheckBox.group = CheckGroup
8
+ export default CheckBox
@@ -0,0 +1,130 @@
1
+ <template>
2
+ <div
3
+ v-if="visible"
4
+ :class="classes"
5
+ >
6
+ <header>
7
+ <div
8
+ class="left"
9
+ @click="back"
10
+ >
11
+ <slot name="left">
12
+ <span class="arrow" />
13
+ <span class="text">返回</span>
14
+ </slot>
15
+ </div>
16
+
17
+ <div class="title dpzvc3-nowrap">
18
+ {{ title }}
19
+ </div>
20
+
21
+ <div class="right">
22
+ <slot name="right">
23
+ <div />
24
+ </slot>
25
+ </div>
26
+ </header>
27
+
28
+ <div
29
+ v-if="fixed"
30
+ class="header-place"
31
+ />
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ import { defineComponent, ref, computed, onMounted, watch } from 'vue'
37
+ import { useRouter } from 'vue-router'
38
+
39
+ const prefixCls = 'dpzvc3-header'
40
+
41
+ export default defineComponent({
42
+ name: 'Dpzvc3Header',
43
+
44
+ props: {
45
+ modelValue: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ fixed: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ title: {
54
+ type: String,
55
+ default: ''
56
+ },
57
+ wechat: {
58
+ type: Boolean,
59
+ default: false
60
+ }
61
+ },
62
+
63
+ emits: ['update:modelValue'],
64
+
65
+ setup (props, { emit }) {
66
+ const router = useRouter()
67
+
68
+ const visible = ref(props.modelValue)
69
+ const isWechat = ref(props.wechat)
70
+
71
+ /** classes */
72
+ const classes = computed(() => [
73
+ prefixCls,
74
+ {
75
+ [`${prefixCls}-fixed`]: props.fixed
76
+ }
77
+ ])
78
+
79
+ /** UA 判断 */
80
+ const isWeixin = computed(() =>
81
+ /micromessenger/i.test(window.navigator.userAgent)
82
+ )
83
+
84
+ const isPcWeixin = computed(() =>
85
+ /windowswechat/i.test(window.navigator.userAgent)
86
+ )
87
+
88
+ /** 同步 v-model */
89
+ watch(
90
+ () => props.modelValue,
91
+ val => {
92
+ visible.value = val
93
+ }
94
+ )
95
+
96
+ watch(visible, val => {
97
+ emit('update:modelValue', val)
98
+ })
99
+
100
+ watch(
101
+ () => props.wechat,
102
+ val => {
103
+ isWechat.value = val
104
+ }
105
+ )
106
+
107
+ /** mounted 逻辑 */
108
+ onMounted(() => {
109
+ if ((isWeixin.value || isPcWeixin.value) && !isWechat.value) {
110
+ visible.value = false
111
+ }
112
+ })
113
+
114
+ /** 返回 */
115
+ const back = () => {
116
+ if (router) {
117
+ router.back()
118
+ } else {
119
+ window.history.back()
120
+ }
121
+ }
122
+
123
+ return {
124
+ visible,
125
+ classes,
126
+ back
127
+ }
128
+ }
129
+ })
130
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/5/4.
3
+ */
4
+ import dpzvc3Header from './header'
5
+ export default dpzvc3Header
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2025/6/19.
3
+ */
4
+ import LoadMore from './loadmore'
5
+ export default LoadMore
@@ -0,0 +1,258 @@
1
+ <template>
2
+ <div
3
+ ref="containerRef"
4
+ :class="containerClasses"
5
+ :style="{ height: height }"
6
+ @scroll="onScroll"
7
+ >
8
+ <!-- 上拉刷新 -->
9
+ <div
10
+ v-if="refresh"
11
+ :class="topClasses"
12
+ :style="{ height: translateY + 'px' }"
13
+ >
14
+ <div :class="statusClass">
15
+ <slot name="top">
16
+ <span class="spinner">
17
+ <Spinner
18
+ v-if="upStatus === 'loading'"
19
+ size="15"
20
+ type="snake"
21
+ />
22
+ </span>
23
+ <span class="dpzvc3-loadmore-text">{{ upText }}</span>
24
+ </slot>
25
+ </div>
26
+ </div>
27
+
28
+ <!-- 内容 -->
29
+ <div :class="contentClasses">
30
+ <slot />
31
+ </div>
32
+
33
+ <!-- 下拉加载更多 -->
34
+ <div
35
+ v-if="loadMore"
36
+ :class="bottomClasses"
37
+ >
38
+ <div :class="statusClass">
39
+ <slot name="bottom">
40
+ <span class="spinner">
41
+ <Spinner
42
+ v-if="downStatus === 'loading'"
43
+ size="15"
44
+ type="snake"
45
+ />
46
+ </span>
47
+ <span class="dpzvc3-loadmore-text">{{ downText }}</span>
48
+ </slot>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+
54
+ <script>
55
+ import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
56
+ import Spinner from '../spinner'
57
+
58
+ const prefixCls = 'dpzvc3-loadmore'
59
+
60
+ export default defineComponent({
61
+ name: 'Dpzvc3Loadmore',
62
+ components: { Spinner },
63
+ props: {
64
+ height: { type: [Number, String], default: '100%' },
65
+ refresh: Function,
66
+ upLoadingText: { type: String, default: '加载中...' },
67
+ upDistance: { type: Number, default: 70 },
68
+ upPullText: { type: String, default: '↓ 下拉刷新' },
69
+ upDropText: { type: String, default: '↑ 释放更新' },
70
+ maxDistance: { type: Number, default: 0 },
71
+ speed: { type: Number, default: 3 },
72
+ downEndText: { type: String, default: '没有更多了' },
73
+ downDropText: { type: String, default: '↑ 上拉加载数据' },
74
+ downLoadingText: { type: String, default: '加载中...' },
75
+ downDistance: { type: Number, default: 50 },
76
+ loadMore: Function,
77
+ hasMore: { type: Boolean, default: true },
78
+ styles: { type: Object, default: () => ({}) },
79
+ auto: { type: Boolean, default: true },
80
+ autoFill: { type: Boolean, default: true }
81
+ },
82
+ setup (props, { emit }) {
83
+ const containerRef = ref(null)
84
+
85
+ // 状态
86
+ const translateY = ref(0)
87
+ const startTranslateY = ref(0)
88
+ const currentY = ref(0)
89
+ const startY = ref(0)
90
+ const upStatus = ref('')
91
+ const downStatus = ref('')
92
+ const direction = ref('')
93
+ const upText = ref('')
94
+ const downText = ref('')
95
+ const down = ref(false)
96
+ const drag = ref(false)
97
+ const more = ref(props.hasMore)
98
+
99
+ // classes
100
+ const containerClasses = computed(() => [prefixCls])
101
+ const topClasses = computed(() => [prefixCls + '-top', { [`${prefixCls}-drag`]: !drag.value }])
102
+ const bottomClasses = computed(() => [prefixCls + '-bottom'])
103
+ const contentClasses = computed(() => [prefixCls + '-content'])
104
+ const statusClass = computed(() => [prefixCls + '-status'])
105
+
106
+ // watch 状态
107
+ watch(upStatus, val => {
108
+ switch (val) {
109
+ case 'pull': upText.value = props.upPullText; break
110
+ case 'drop': upText.value = props.upDropText; break
111
+ case 'loading': upText.value = props.upLoadingText; break
112
+ }
113
+ emit('on-change-up-status', val)
114
+ })
115
+
116
+ watch(downStatus, val => {
117
+ switch (val) {
118
+ case 'end': downText.value = props.downEndText; break
119
+ case 'drop': downText.value = props.downDropText; break
120
+ case 'loading': downText.value = props.downLoadingText; break
121
+ default: downText.value = ''; break
122
+ }
123
+ emit('on-change-down-status', val)
124
+ })
125
+
126
+ watch(() => props.hasMore, val => {
127
+ more.value = val
128
+ if (!val) downStatus.value = 'end'
129
+ })
130
+
131
+ // 方法
132
+ const isBottom = () => {
133
+ const el = containerRef.value
134
+ return el.scrollHeight <= el.offsetHeight
135
+ }
136
+
137
+ const onLoadOff = () => {
138
+ translateY.value = 0
139
+ upStatus.value = ''
140
+ downStatus.value = ''
141
+ if (!more.value) downStatus.value = 'end'
142
+ setTimeout(() => {
143
+ if (more.value && isBottom()) {
144
+ direction.value = 'up'
145
+ downStatus.value = 'loading'
146
+ props.loadMore && props.loadMore()
147
+ }
148
+ }, 1000)
149
+ }
150
+
151
+ const onScroll = e => {
152
+ e.preventDefault()
153
+ if (downStatus.value === 'loading') return
154
+ const el = containerRef.value
155
+ const scrollTop = el.scrollTop
156
+ if (props.loadMore) {
157
+ const absY = el.scrollHeight - (el.offsetHeight + scrollTop)
158
+ if (absY > props.downDistance && downStatus.value === 'drop') downStatus.value = ''
159
+ else if (absY <= props.downDistance && absY > props.downDistance && more.value) downStatus.value = 'drop'
160
+ else if (absY <= props.downDistance) {
161
+ downStatus.value = 'loading'
162
+ if (more.value) props.loadMore()
163
+ else setTimeout(onLoadOff, 1000)
164
+ }
165
+ }
166
+ }
167
+
168
+ const onTouchStart = e => {
169
+ if (upStatus.value === 'loading') return
170
+ startY.value = e.touches[0].clientY
171
+ startTranslateY.value = translateY.value
172
+ down.value = false
173
+ }
174
+
175
+ const onTouchMove = e => {
176
+ const el = containerRef.value
177
+ if (!el) return
178
+ const pos = el.getBoundingClientRect()
179
+ if (upStatus.value === 'loading' || (startY.value < pos.top && startY.value > pos.bottom)) return
180
+ currentY.value = e.touches[0].clientY
181
+ const distance = (currentY.value - startY.value) / props.speed
182
+ const scrollTop = el.scrollTop
183
+ direction.value = distance > 0 ? 'down' : 'up'
184
+
185
+ if (currentY.value >= startY.value && props.refresh && scrollTop === 0 && direction.value === 'down') {
186
+ e.preventDefault()
187
+ e.stopPropagation()
188
+ translateY.value = props.maxDistance > 0 ? Math.min(distance - scrollTop, props.maxDistance) : distance - scrollTop
189
+ if (translateY.value < 0) translateY.value = 0
190
+ upStatus.value = translateY.value >= props.upDistance ? 'drop' : 'pull'
191
+ drag.value = true
192
+ down.value = down.value || isBottom()
193
+ }
194
+ }
195
+
196
+ const onTouchEnd = e => {
197
+ if (upStatus.value === 'loading') return
198
+ const el = containerRef.value
199
+ if (direction.value === 'down' && el.scrollTop <= 0 && translateY.value >= 0) {
200
+ if (upStatus.value === 'drop') {
201
+ translateY.value = 40
202
+ upStatus.value = 'loading'
203
+ props.refresh && props.refresh()
204
+ } else {
205
+ translateY.value = 0
206
+ }
207
+ }
208
+ direction.value = ''
209
+ drag.value = false
210
+ }
211
+
212
+ onMounted(() => {
213
+ if (props.auto && props.refresh) {
214
+ translateY.value = 40
215
+ drag.value = false
216
+ direction.value = 'down'
217
+ upStatus.value = 'loading'
218
+ props.refresh()
219
+ }
220
+
221
+ const el = containerRef.value
222
+ if (el) {
223
+ el.addEventListener('touchstart', onTouchStart, false)
224
+ el.addEventListener('touchmove', onTouchMove, false)
225
+ el.addEventListener('touchend', onTouchEnd, false)
226
+ }
227
+ })
228
+
229
+ onBeforeUnmount(() => {
230
+ const el = containerRef.value
231
+ if (el) {
232
+ el.removeEventListener('touchstart', onTouchStart, false)
233
+ el.removeEventListener('touchmove', onTouchMove, false)
234
+ el.removeEventListener('touchend', onTouchEnd, false)
235
+ }
236
+ })
237
+
238
+ return {
239
+ containerRef,
240
+ translateY,
241
+ upStatus,
242
+ downStatus,
243
+ upText,
244
+ downText,
245
+ down,
246
+ drag,
247
+ more,
248
+ containerClasses,
249
+ topClasses,
250
+ bottomClasses,
251
+ contentClasses,
252
+ statusClass,
253
+ onScroll,
254
+ onLoadOff
255
+ }
256
+ }
257
+ })
258
+ </script>
@@ -0,0 +1,60 @@
1
+ /**
2
+ * confirm.js - Vue 3 版本
3
+ * 负责创建 MessageGroup 实例
4
+ */
5
+
6
+ import { createVNode, render } from 'vue'
7
+ import MessageGroup from './messageGroup.vue'
8
+
9
+ MessageGroup.newInstance = function (props = {}) {
10
+ const container = document.createElement('div')
11
+ document.body.appendChild(container)
12
+
13
+ let vnode = null
14
+ let instance = null // 组件实例 proxy
15
+
16
+ const mount = () => {
17
+ vnode = createVNode(MessageGroup, {
18
+ ...props
19
+ // 这里使用 ref 拿到组件实例 proxy
20
+ })
21
+ render(vnode, container)
22
+ instance = vnode.component.proxy
23
+ }
24
+
25
+ mount()
26
+
27
+ return {
28
+ add (options) {
29
+ if (instance && instance.add) {
30
+ instance.add(options)
31
+ }
32
+ },
33
+ remove (name) {
34
+ if (instance && instance.remove) {
35
+ instance.remove(name)
36
+ }
37
+ },
38
+ closeAll () {
39
+ if (instance && instance.closeAll) {
40
+ instance.closeAll()
41
+ }
42
+ },
43
+ component: instance,
44
+ destroy () {
45
+ if (instance && instance.closeAll) {
46
+ instance.closeAll()
47
+ }
48
+
49
+ setTimeout(() => {
50
+ render(null, container)
51
+ if (container.parentNode) {
52
+ container.parentNode.removeChild(container)
53
+ }
54
+ instance = null
55
+ }, 500)
56
+ }
57
+ }
58
+ }
59
+
60
+ export default MessageGroup
@@ -0,0 +1,111 @@
1
+ /**
2
+ * message/index.js - Vue 3 版本
3
+ */
4
+
5
+ import MessageGroup from './confirm'
6
+ import { randomStr } from '../../utils/util'
7
+
8
+ let defaultDuration = 1
9
+ let top = '0'
10
+
11
+ let MGInstance = null
12
+ let seed = 1
13
+ const time = Date.now()
14
+
15
+ function getName () {
16
+ return `dpzvc3-message-group_${time}_${seed++}_${randomStr()}`
17
+ }
18
+
19
+ function getNewInstance () {
20
+ if (!MGInstance) {
21
+ MGInstance = MessageGroup.newInstance({
22
+ styles: {
23
+ top,
24
+ right: '0'
25
+ }
26
+ })
27
+ }
28
+
29
+ return MGInstance
30
+ }
31
+
32
+ function message (props = {}) {
33
+ const {
34
+ text = '',
35
+ name = getName(),
36
+ duration = props.duration === 0 ? 0 : (props.duration || defaultDuration),
37
+ showLeft = false,
38
+ rightHide = true,
39
+ loading = false,
40
+ onClose = () => {},
41
+ styles = {},
42
+ type = 'normal',
43
+ position = 'center'
44
+ } = props
45
+
46
+ const instance = getNewInstance()
47
+ // console.log(instance.add, 'instance')
48
+ instance.add({
49
+ name,
50
+ text,
51
+ duration,
52
+ showLeft,
53
+ rightHide,
54
+ loading,
55
+ onClose,
56
+ styles,
57
+ type,
58
+ position
59
+ })
60
+
61
+ // 返回手动关闭函数(保持旧行为)
62
+ return function remove () {
63
+ instance.remove(name)
64
+ }
65
+ }
66
+
67
+ export default {
68
+
69
+ show (options = {}) {
70
+ return message(options)
71
+ },
72
+
73
+ success (options = {}) {
74
+ return message({
75
+ ...options,
76
+ type: 'success'
77
+ })
78
+ },
79
+
80
+ error (options = {}) {
81
+ return message({
82
+ ...options,
83
+ type: 'error'
84
+ })
85
+ },
86
+
87
+ loading (options = {}) {
88
+ return message({
89
+ ...options,
90
+ type: 'loading',
91
+ duration: 0,
92
+ showLeft: true
93
+ })
94
+ },
95
+
96
+ config (options = {}) {
97
+ if (options.top !== undefined) {
98
+ top = options.top
99
+ }
100
+
101
+ if (options.duration !== undefined) {
102
+ defaultDuration = options.duration
103
+ }
104
+ },
105
+
106
+ destroy () {
107
+ if (!MGInstance) return
108
+ MGInstance.destroy()
109
+ MGInstance = null
110
+ }
111
+ }