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,89 @@
1
+ <template>
2
+ <div
3
+ v-show="show"
4
+ :class="classes"
5
+ :style="getStyles"
6
+ >
7
+ <ul>
8
+ <li
9
+ v-for="(item, index) in items"
10
+ :key="index"
11
+ >
12
+ <!-- 外部链接 -->
13
+ <template v-if="/(http|https)/i.test(item.path)">
14
+ <a
15
+ :href="item.path"
16
+ :class="itemClass(index)"
17
+ >
18
+ <span v-html="getIconHtml(index)" />
19
+ <p>{{ item.name }}</p>
20
+ </a>
21
+ </template>
22
+
23
+ <!-- 内部路由 -->
24
+ <template v-else>
25
+ <router-link
26
+ :to="item.path"
27
+ :class="itemClass(index)"
28
+ >
29
+ <slot name="item">
30
+ <span v-html="getIconHtml(index)" />
31
+ <p>{{ item.name }}</p>
32
+ </slot>
33
+ </router-link>
34
+ </template>
35
+ </li>
36
+ </ul>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import { defineComponent, ref, computed, watch } from 'vue'
42
+
43
+ const prefixCls = 'dpzvc3-tab'
44
+
45
+ export default defineComponent({
46
+ name: 'Dpzvc3Tab',
47
+ props: {
48
+ items: { type: Array, default: () => [] },
49
+ modelValue: { type: Boolean, default: true },
50
+ index: { type: [Number, String], default: 0 },
51
+ border: { type: Boolean, default: true },
52
+ styles: { type: Object, default: () => ({}) }
53
+ },
54
+ setup (props) {
55
+ // 控制显示
56
+ const show = ref(props.modelValue)
57
+
58
+ watch(() => props.modelValue, (val) => {
59
+ show.value = val
60
+ })
61
+
62
+ // 计算类名和样式
63
+ const classes = computed(() => [prefixCls])
64
+ const getStyles = computed(() => ({ ...props.styles }))
65
+
66
+ // tab item 样式
67
+ const itemClass = (index) => {
68
+ const _class = [`tab-item-${index}`]
69
+ if (Number(props.index) === Number(index)) _class.push('cur')
70
+ return _class
71
+ }
72
+
73
+ // icon 显示
74
+ const getIconHtml = (index) => {
75
+ const item = props.items[index]
76
+ if (!item) return ''
77
+ return Number(props.index) === Number(index) ? (item.iconCur || item.icon) : item.icon
78
+ }
79
+
80
+ return {
81
+ show,
82
+ classes,
83
+ getStyles,
84
+ itemClass,
85
+ getIconHtml
86
+ }
87
+ }
88
+ })
89
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2025/11/29.
3
+ */
4
+ import ToTop from './topTop'
5
+ export default ToTop
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div
3
+ v-show="back"
4
+ :class="classes"
5
+ :style="positionStyles"
6
+ @click="toTop"
7
+ >
8
+ <slot>
9
+ <div :class="wrapperClasses" />
10
+ </slot>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import { ref, computed, onMounted, onBeforeUnmount, defineComponent } from 'vue'
16
+ import { scrollTop } from '../../utils/util'
17
+
18
+ const prefixCls = 'dpzvc3-toTop'
19
+
20
+ export default defineComponent({
21
+ name: 'ToTop',
22
+ props: {
23
+ distance: {
24
+ type: Number,
25
+ default: 200
26
+ },
27
+ bottom: {
28
+ type: [Number, String],
29
+ default: 30
30
+ },
31
+ right: {
32
+ type: [Number, String],
33
+ default: 30
34
+ },
35
+ duration: {
36
+ type: Number,
37
+ default: 1000
38
+ }
39
+ },
40
+ setup (props) {
41
+ const back = ref(false)
42
+
43
+ const classes = computed(() => [prefixCls])
44
+ const wrapperClasses = computed(() => [`${prefixCls}-wrapper`])
45
+ const positionStyles = computed(() => ({
46
+ bottom: props.bottom + 'px',
47
+ right: props.right + 'px'
48
+ }))
49
+
50
+ // 滚动监听
51
+ const scroll = () => {
52
+ back.value = window.pageYOffset > props.distance
53
+ }
54
+
55
+ const toTop = () => {
56
+ scrollTop(window, window.pageYOffset, 0, props.duration)
57
+ }
58
+
59
+ onMounted(() => {
60
+ window.addEventListener('scroll', scroll, false)
61
+ window.addEventListener('resize', scroll, false)
62
+ })
63
+
64
+ onBeforeUnmount(() => {
65
+ window.removeEventListener('scroll', scroll, false)
66
+ window.removeEventListener('resize', scroll, false)
67
+ })
68
+
69
+ return {
70
+ back,
71
+ classes,
72
+ wrapperClasses,
73
+ positionStyles,
74
+ toTop
75
+ }
76
+ }
77
+ })
78
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2025/10/26.
3
+ */
4
+ import Upload from './upload'
5
+ export default Upload
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <div
3
+ :class="classes"
4
+ :style="styles"
5
+ >
6
+ <slot>
7
+ <div :class="wrapperClasses">
8
+ 图片上传
9
+ </div>
10
+ </slot>
11
+ <input
12
+ ref="upload"
13
+ type="file"
14
+ :accept="accept"
15
+ :multiple="multiple"
16
+ @change="showPhoto"
17
+ >
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import { ref, computed, defineComponent, getCurrentInstance, watch } from 'vue'
23
+ import exifr from 'exifr'
24
+ import MegaPixImage from '../../lib/MegaPixImage'
25
+ import { JPEG } from '../../utils/util'
26
+
27
+ const prefixCls = 'dpzvc3-upload'
28
+
29
+ export default defineComponent({
30
+ name: 'Dpzvc3Upload',
31
+ props: {
32
+ multiple: { type: Boolean, default: false },
33
+ accept: { type: String, default: 'image/*' },
34
+ styles: { type: Object, default: () => ({}) }
35
+ },
36
+ setup (props, { emit }) {
37
+ const { proxy } = getCurrentInstance()
38
+ // const $Indicator = appContext.config.globalProperties.$Indicator
39
+
40
+ const files = ref([])
41
+ const fileLength = ref(0)
42
+ const upload = ref(null)
43
+
44
+ const classes = computed(() => [prefixCls])
45
+ const wrapperClasses = computed(() => [`${prefixCls}-wrapper`])
46
+
47
+ watch(files, (val) => {
48
+ emit('on-change-file', val)
49
+ })
50
+
51
+ const showPhoto = async (e) => {
52
+ proxy.$Indicator.snake({ text: '上传中' })
53
+ files.value = []
54
+ const fileList = e.target.files
55
+ fileLength.value = fileList.length
56
+
57
+ for (let i = 0; i < fileList.length; i++) {
58
+ const file = fileList[i]
59
+ try {
60
+ const Orientation = await exifr.orientation(file)
61
+ const dataURL = await new Promise((resolve, reject) => {
62
+ const reader = new FileReader()
63
+ reader.readAsDataURL(file)
64
+ reader.onload = () => resolve(reader.result)
65
+ reader.onerror = (err) => reject(err)
66
+ })
67
+
68
+ const img = new Image()
69
+ img.src = dataURL
70
+
71
+ await new Promise((resolve) => {
72
+ img.onload = () => {
73
+ create(img, Orientation)
74
+ resolve()
75
+ }
76
+ })
77
+ } catch (err) {
78
+ console.error('读取图片或 EXIF 失败', err)
79
+ }
80
+ }
81
+
82
+ e.target.value = ''
83
+ }
84
+
85
+ const create = (file, Orientation) => {
86
+ let data = null
87
+ const img = new Image()
88
+ const mpImg = new MegaPixImage(file)
89
+
90
+ mpImg.render(img, { maxWidth: 600, quality: 0.8 })
91
+ img.onload = function () {
92
+ const canvas = document.createElement('canvas')
93
+ const ctx = canvas.getContext('2d')
94
+ ctx.clearRect(0, 0, canvas.width, canvas.height)
95
+ canvas.width = img.width
96
+ canvas.height = img.height
97
+ ctx.drawImage(this, 0, 0, canvas.width, canvas.height)
98
+ data = canvas.toDataURL('image/jpeg', 0.8)
99
+
100
+ if (navigator.userAgent.match(/iphone/i)) {
101
+ if (Orientation && Orientation !== 1) {
102
+ switch (Orientation) {
103
+ case 6: rotateImg(this, 'left', canvas); break
104
+ case 8: rotateImg(this, 'right', canvas); break
105
+ case 3:
106
+ rotateImg(this, 'right', canvas)
107
+ rotateImg(this, 'right', canvas)
108
+ break
109
+ }
110
+ }
111
+ data = canvas.toDataURL('image/jpeg', 0.8)
112
+ }
113
+
114
+ if (navigator.userAgent.match(/Android/i)) {
115
+ const JPEGEncoder = JPEG.JPEGEncoder
116
+ const encoder = new JPEGEncoder()
117
+ data = encoder.encode(ctx.getImageData(0, 0, canvas.width, canvas.height), 80)
118
+ }
119
+
120
+ const result = {
121
+ base64: data,
122
+ clearBase64: data.substr(data.indexOf(',') + 1)
123
+ }
124
+
125
+ files.value.push(result)
126
+
127
+ if (files.value.length === fileLength.value) {
128
+ proxy.$Indicator.remove()
129
+ }
130
+ }
131
+ }
132
+
133
+ const rotateImg = (img, direction, canvas) => {
134
+ const minStep = 0
135
+ const maxStep = 3
136
+ if (!img) return
137
+ const height = img.height
138
+ const width = img.width
139
+ let step = 2
140
+ if (direction === 'right') {
141
+ step++
142
+ step > maxStep && (step = minStep)
143
+ } else {
144
+ step--
145
+ step < minStep && (step = maxStep)
146
+ }
147
+ const degree = (step * 90 * Math.PI) / 180
148
+ const ctx = canvas.getContext('2d')
149
+ switch (step) {
150
+ case 0: canvas.width = width; canvas.height = height; ctx.drawImage(img, 0, 0, canvas.width, canvas.height); break
151
+ case 1: canvas.width = height; canvas.height = width; ctx.rotate(degree); ctx.drawImage(img, 0, -height, canvas.height, canvas.width); break
152
+ case 2: canvas.width = width; canvas.height = height; ctx.rotate(degree); ctx.drawImage(img, -width, -height, canvas.width, canvas.height); break
153
+ case 3: canvas.width = height; canvas.height = width; ctx.rotate(degree); ctx.drawImage(img, -width, 0, canvas.height, canvas.width); break
154
+ }
155
+ }
156
+
157
+ return {
158
+ files,
159
+ classes,
160
+ wrapperClasses,
161
+ upload,
162
+ showPhoto
163
+ }
164
+ }
165
+ })
166
+ </script>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Created by yishide on 16/7/18.
3
+ */
4
+
5
+ const config = {
6
+ env: process.env.NODE_ENV,
7
+ PROJECT: 'dpzvc3',
8
+ VERSION: '3.0',
9
+ doc_title: '',
10
+ baseUrl: '',
11
+ isIPad: /ipad/i.test(window.navigator.userAgent),
12
+ isIphone: /iphone|ipad|ipod/i.test(window.navigator.userAgent),
13
+ isWechat: /MicroMessenger/i.test(window.navigator.userAgent),
14
+ isUCBrowser: /UCWEB|UCBrowser/i.test(window.navigator.userAgent)
15
+ }
16
+ export default config
@@ -0,0 +1,42 @@
1
+ const clickoutsideContext = '@@clickoutsideContext'
2
+
3
+ export default {
4
+ beforeMount (el, binding) {
5
+ // document 事件处理函数
6
+ const documentHandler = (e) => {
7
+ // 如果点击元素本身或其子元素,则不触发
8
+ if (!el.contains(e.target)) {
9
+ // 调用传入的方法
10
+ if (typeof binding.value === 'function') {
11
+ binding.value(e)
12
+ }
13
+ }
14
+ }
15
+
16
+ // 保存上下文信息到 el 上,方便解绑
17
+ el[clickoutsideContext] = {
18
+ documentHandler,
19
+ event: binding.arg || 'click'
20
+ }
21
+
22
+ document.addEventListener(el[clickoutsideContext].event, documentHandler)
23
+ },
24
+
25
+ updated (el, binding) {
26
+ // 可以在更新时替换方法
27
+ // binding.value 已经是最新函数
28
+ el[clickoutsideContext].documentHandler = (e) => {
29
+ if (!el.contains(e.target) && typeof binding.value === 'function') {
30
+ binding.value(e)
31
+ }
32
+ }
33
+ },
34
+
35
+ unmounted (el) {
36
+ document.removeEventListener(
37
+ el[clickoutsideContext].event,
38
+ el[clickoutsideContext].documentHandler
39
+ )
40
+ delete el[clickoutsideContext]
41
+ }
42
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Created by admin on 2017/5/5.
3
+ */
4
+ function getTarget (node) {
5
+ // eslint-disable-next-line no-void
6
+ if (node === void 0) {
7
+ node = document.body
8
+ }
9
+ if (node === true) { return document.body }
10
+ return node instanceof window.Node ? node : document.querySelector(node)
11
+ }
12
+
13
+ const directive = {
14
+ inserted (el, { value }, vnode) {
15
+ el.className = el.className ? el.className + ' v-transfer-dom' : 'v-transfer-dom'
16
+ const parentNode = el.parentNode
17
+ const home = document.createComment('')
18
+ let hasMovedOut = false
19
+
20
+ if (value !== false) {
21
+ parentNode.replaceChild(home, el) // moving out, el is no longer in the document
22
+ getTarget(value).appendChild(el) // moving into new place
23
+ hasMovedOut = true
24
+ }
25
+ if (!el.__transferDomData) {
26
+ el.__transferDomData = {
27
+ parentNode,
28
+ home,
29
+ target: getTarget(value),
30
+ hasMovedOut
31
+ }
32
+ }
33
+ },
34
+ componentUpdated (el, { value }) {
35
+ // need to make sure children are done updating (vs. `update`)
36
+ const ref$1 = el.__transferDomData
37
+ // homes.get(el)
38
+ const parentNode = ref$1.parentNode
39
+ const home = ref$1.home
40
+ const hasMovedOut = ref$1.hasMovedOut // recall where home is
41
+
42
+ if (!hasMovedOut && value) {
43
+ // remove from document and leave placeholder
44
+ parentNode.replaceChild(home, el)
45
+ // append to target
46
+ getTarget(value).appendChild(el)
47
+ el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: true, target: getTarget(value) })
48
+ } else if (hasMovedOut && value === false) {
49
+ // previously moved, coming back home
50
+ parentNode.replaceChild(el, home)
51
+ el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: false, target: getTarget(value) })
52
+ } else if (value) {
53
+ // already moved, going somewhere else
54
+ getTarget(value).appendChild(el)
55
+ }
56
+ },
57
+ unbind: function unbind (el, binding) {
58
+ el.className = el.className.replace('v-transfer-dom', '')
59
+ if (el.__transferDomData.hasMovedOut === true) {
60
+ el.__transferDomData.parentNode && el.__transferDomData.parentNode.appendChild(el)
61
+ }
62
+ el.__transferDomData = null
63
+ }
64
+ }
65
+
66
+ export default directive
package/src/index.js ADDED
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Created by admin on 2025/12/25.
3
+ * Vue 3 version
4
+ */
5
+
6
+ /* ========= 组件引入 ========= */
7
+
8
+ import VButton from './components/button'
9
+ import CheckBox from './components/checkBox'
10
+ import DpHeader from './components/header'
11
+ import Message from './components/message'
12
+ import Modal from './components/modal'
13
+ import Picker from './components/picker'
14
+ import RadioBox from './components/radioBox'
15
+ import Swipe from './components/swipe'
16
+ import Tab from './components/tab'
17
+ import Prompt from './components/prompt'
18
+ import SlideBar from './components/slideBar'
19
+ import TextBar from './components/Text'
20
+ import Upload from './components/upload'
21
+ import ActionSheet from './components/action-sheet'
22
+ import SwitchBar from './components/switchbar'
23
+ import Rater from './components/rater'
24
+ import Spinner from './components/spinner'
25
+ import LoadMore from './components/loadMore'
26
+ import Popup from './components/popup'
27
+ import Indicator from './components/Indicator'
28
+ import Progress from './components/progress'
29
+ import ToTop from './components/toTop'
30
+ import Cell from './components/cell'
31
+ import CellSwipe from './components/cell-swipe'
32
+ import Badge from './components/badge'
33
+ import Card from './components/card'
34
+
35
+ /* ========= 组件集合 ========= */
36
+
37
+ const components = {
38
+ VButton,
39
+ CheckBox,
40
+ CheckBoxGroup: CheckBox.group,
41
+ RadioBox,
42
+ RadioBoxGroup: RadioBox.group,
43
+ DpHeader,
44
+ Picker,
45
+ Swipe,
46
+ Tab,
47
+ SlideBar,
48
+ TextBar,
49
+ Number: TextBar.Number,
50
+ Upload,
51
+ ActionSheet,
52
+ SwitchBar,
53
+ Rater,
54
+ Spinner,
55
+ LoadMore,
56
+ Popup,
57
+ DpProgress: Progress,
58
+ ToTop,
59
+ Cell,
60
+ CellSwipe,
61
+ Badge,
62
+ Card
63
+ }
64
+
65
+ /* ========= 服务组件 ========= */
66
+
67
+ const services = {
68
+ Message,
69
+ Modal,
70
+ Prompt,
71
+ Indicator
72
+ }
73
+
74
+ /* ========= 给单个组件补 install(Vue 3 写法) ========= */
75
+
76
+ Object.keys(components).forEach(key => {
77
+ const component = components[key]
78
+ if (component && !component.install) {
79
+ component.install = (app) => {
80
+ app.component(key, component)
81
+ }
82
+ }
83
+ })
84
+
85
+ Object.keys(services).forEach(key => {
86
+ const service = services[key]
87
+ if (service && !service.install) {
88
+ service.install = (app) => {
89
+ app.config.globalProperties[`$${key}`] = service
90
+ }
91
+ }
92
+ })
93
+
94
+ /* ========= 全量 install ========= */
95
+
96
+ const install = (app) => {
97
+ // if (install.installed) return
98
+ // install.installed = true
99
+ if (!app) {
100
+ console.warn('dpzvc3 install: app is undefined, ensure you are using Vue 3 createApp')
101
+ return
102
+ }
103
+ // 注册组件
104
+ Object.keys(components).forEach(key => {
105
+ app.component(key, components[key])
106
+ })
107
+
108
+ // 注册服务
109
+ Object.keys(services).forEach(key => {
110
+ app.config.globalProperties[`$${key}`] = services[key]
111
+ })
112
+ }
113
+
114
+ /* ========= 按需导出 ========= */
115
+
116
+ export {
117
+ VButton,
118
+ CheckBox,
119
+ DpHeader,
120
+ Message,
121
+ Modal,
122
+ Prompt,
123
+ Picker,
124
+ RadioBox,
125
+ Swipe,
126
+ Tab,
127
+ SlideBar,
128
+ TextBar,
129
+ Upload,
130
+ ActionSheet,
131
+ SwitchBar,
132
+ Rater,
133
+ Spinner,
134
+ LoadMore,
135
+ Popup,
136
+ Indicator,
137
+ Progress,
138
+ ToTop,
139
+ Cell,
140
+ CellSwipe,
141
+ Badge,
142
+ Card
143
+ }
144
+
145
+ /* ========= 默认导出 ========= */
146
+
147
+ export default {
148
+ install
149
+ }