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,125 @@
1
+ <template>
2
+ <Modal
3
+ v-model="visible"
4
+ :width="width"
5
+ :title="title"
6
+ :style="styles"
7
+ :mask-closable="maskClosable"
8
+ >
9
+ <template #header>
10
+ <div
11
+ class="dpzvc3-modal-header-inner ellipse-fir"
12
+ v-html="title"
13
+ />
14
+ </template>
15
+
16
+ <template #body>
17
+ <div class="dpzvc3-prompt-body-inner">
18
+ <div class="dpzvc3-prompt-content">
19
+ <span class="dpzvc3-prompt-spec">{{ spec }}</span>
20
+ <TextBar
21
+ v-model="texts"
22
+ type="text"
23
+ :placeholder="placeholder"
24
+ />
25
+ <div
26
+ v-if="message"
27
+ class="dpzvc3-prompt-error"
28
+ v-html="message"
29
+ />
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <template #footer>
35
+ <VButton
36
+ :styles="{ background: '#ffffff', color: 'red' }"
37
+ @click="ok"
38
+ >
39
+ <template #button-inner>
40
+ {{ okText }}
41
+ </template>
42
+ </VButton>
43
+
44
+ <VButton
45
+ :styles="{ background: '#ffffff', color: '#ccc' }"
46
+ @click="cancle"
47
+ >
48
+ <template #button-inner>
49
+ {{ cancleText }}
50
+ </template>
51
+ </VButton>
52
+ </template>
53
+ </Modal>
54
+ </template>
55
+
56
+ <script>
57
+ import { defineComponent, ref, watch } from 'vue'
58
+ import Modal from '../modal/modal.vue'
59
+ import TextBar from '../Text/textBar.vue'
60
+ import VButton from '../button/button.vue'
61
+
62
+ export default defineComponent({
63
+ name: 'Dpzvc3Prompt',
64
+ components: { Modal, TextBar, VButton },
65
+ props: {
66
+ value: { type: Boolean, default: false },
67
+ text: { type: String, default: '' },
68
+ closable: { type: Boolean, default: true },
69
+ maskClosable: { type: Boolean, default: true },
70
+ title: String,
71
+ width: { type: String, default: '220px' },
72
+ okText: { type: String, default: '确定' },
73
+ cancleText: { type: String, default: '取消' },
74
+ loading: { type: Boolean, default: false },
75
+ styles: Object,
76
+ spec: { type: String, default: '提示' },
77
+ validator: { type: [RegExp, Function], default: null },
78
+ msg: String,
79
+ placeholderText: String,
80
+ onOk: { type: Function, default: () => {} },
81
+ onCancle: { type: Function, default: () => {} }
82
+ },
83
+ emits: ['update:value', 'on-ok', 'on-cancle'],
84
+ setup (props, { emit }) {
85
+ // 子组件内部状态
86
+ const visible = ref(props.value)
87
+ const texts = ref(props.text)
88
+ const message = ref(props.msg || '')
89
+ const placeholder = ref(props.placeholderText)
90
+ const buttonLoading = ref(false)
91
+
92
+ // 同步父组件变化
93
+ watch(() => props.value, val => (visible.value = val))
94
+
95
+ watch(() => props.val, val => (texts.value = val))
96
+ watch(() => props.loading, val => (buttonLoading.value = val))
97
+
98
+ // 点击确定
99
+ function ok () {
100
+ let valid = true
101
+ if (props.validator) {
102
+ if (props.validator instanceof RegExp) valid = props.validator.test(texts.value)
103
+ else if (typeof props.validator === 'function') valid = props.validator(texts.value)
104
+ }
105
+ if (valid !== true) {
106
+ message.value = typeof valid === 'string' ? valid : ''
107
+ return
108
+ }
109
+
110
+ emit('update:value', false) // 通知父组件关闭弹窗
111
+ props.onOk?.(texts.value)
112
+ emit('on-ok', texts.value)
113
+ }
114
+
115
+ // 点击取消
116
+ function cancle () {
117
+ emit('update:value', false)
118
+ props.onCancle?.()
119
+ emit('on-cancle')
120
+ }
121
+
122
+ return { visible, texts, message, placeholder, buttonLoading, ok, cancle }
123
+ }
124
+ })
125
+ </script>
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Created by admin on 2017/4/19.
3
+ */
4
+ import RadioBox from './radiobox.vue'
5
+ import RadioBoxGroup from './radiobox-group.vue'
6
+
7
+ RadioBox.group = RadioBoxGroup
8
+ export default RadioBox
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { defineComponent, computed, watch, provide, ref } from 'vue'
9
+
10
+ const prefixCls = 'dpzvc3-radioBoxGroup'
11
+
12
+ export default defineComponent({
13
+ name: 'RadioBoxGroup',
14
+ props: {
15
+ modelValue: {
16
+ type: [String, Boolean, Number],
17
+ default: ''
18
+ },
19
+ vertical: {
20
+ type: Boolean,
21
+ default: false
22
+ }
23
+ },
24
+ emits: ['update:modelValue', 'on-change', 'on-form-change'],
25
+ setup (props, { emit }) {
26
+ const currentValue = ref(props.modelValue)
27
+
28
+ // 提供给子组件
29
+ provide('radioBoxGroup', {
30
+ currentValue,
31
+ change: (val) => {
32
+ currentValue.value = val
33
+ emit('update:modelValue', val)
34
+ emit('on-change', val)
35
+ emit('on-form-change', val)
36
+ }
37
+ })
38
+
39
+ // 监听外部 v-model 改变
40
+ watch(
41
+ () => props.modelValue,
42
+ (val) => {
43
+ currentValue.value = val
44
+ }
45
+ )
46
+
47
+ const classes = computed(() => [
48
+ prefixCls,
49
+ { [`${prefixCls}-vertical`]: props.vertical }
50
+ ])
51
+
52
+ return {
53
+ classes,
54
+ currentValue
55
+ }
56
+ }
57
+ })
58
+ </script>
59
+
60
+ <style scoped>
61
+ .dpzvc3-radioBoxGroup-vertical {
62
+ display: flex;
63
+ justify-content: center;
64
+ flex-direction: column;
65
+ }
66
+ </style>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <label :class="classes">
3
+ <span :class="wrapperClasses">
4
+ <span :class="innerClasses">
5
+ <input
6
+ type="radio"
7
+ :disabled="disable"
8
+ :checked="isChecked"
9
+ :class="inputClass"
10
+ @change="handleChange"
11
+ >
12
+ </span>
13
+ </span>
14
+ <slot v-if="show"><span ref="slotEl">{{ label }}</span></slot>
15
+ </label>
16
+ </template>
17
+
18
+ <script>
19
+ import { defineComponent, inject, computed, ref, onMounted } from 'vue'
20
+
21
+ const prefixCls = 'dpzvc3-radiobox'
22
+
23
+ export default defineComponent({
24
+ name: 'RadioBox',
25
+ props: {
26
+ label: { type: [String, Number], required: true },
27
+ modalValue: { type: Boolean, default: false },
28
+ disable: { type: Boolean, default: false }
29
+ },
30
+ emits: ['update:value', 'on-change'],
31
+ setup (props, { emit }) {
32
+ const slotEl = ref(null)
33
+ const show = ref(true)
34
+ const group = inject('radioBoxGroup', null) // 如果有group则为对象,没有则为null
35
+
36
+ const isChecked = computed(() => {
37
+ if (group) {
38
+ return group.currentValue.value === props.label
39
+ } else {
40
+ return props.modalValue
41
+ }
42
+ })
43
+
44
+ const classes = computed(() => [prefixCls])
45
+ const wrapperClasses = computed(() => [
46
+ `${prefixCls}-wrapper`,
47
+ {
48
+ [`${prefixCls}-checked`]: isChecked.value,
49
+ [`${prefixCls}-disable`]: props.disable
50
+ }
51
+ ])
52
+ const innerClasses = computed(() => [`${prefixCls}-inner`])
53
+ const inputClass = computed(() => [`${prefixCls}-input`])
54
+
55
+ function handleChange (e) {
56
+ if (props.disable) return
57
+ const checked = e.target.checked
58
+
59
+ if (group) {
60
+ group.change(props.label)
61
+ } else {
62
+ emit('update:modalValue', checked)
63
+ emit('on-change', checked)
64
+ }
65
+ }
66
+
67
+ onMounted(() => {
68
+ if (!group) {
69
+ // 判断是否有 slot 内容
70
+ if (slotEl.value && !slotEl.value.innerHTML) {
71
+ show.value = false
72
+ }
73
+ }
74
+ })
75
+
76
+ return {
77
+ classes,
78
+ wrapperClasses,
79
+ innerClasses,
80
+ inputClass,
81
+ isChecked,
82
+ handleChange,
83
+ show,
84
+ slotEl
85
+ }
86
+ }
87
+ })
88
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/5/31.
3
+ */
4
+ import Rater from './rater'
5
+ export default Rater
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <span
4
+ v-for="(item, key) in max"
5
+ :key="key"
6
+ :class="starClass"
7
+ :style="parentStyles(key)"
8
+ >
9
+ {{ star }}
10
+ <span
11
+ :style="childStyles(key)"
12
+ @click="changeValue(key)"
13
+ >{{ star }}</span>
14
+ </span>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import { defineComponent, ref, watch, computed } from 'vue'
20
+
21
+ const prefixCls = 'dpzvc3-rater'
22
+
23
+ export default defineComponent({
24
+ name: 'Dpzvc3Rater',
25
+ props: {
26
+ modelValue: { type: Number, default: -1 }, // 支持 v-model
27
+ distance: { type: Number, default: 10 },
28
+ max: { type: Number, default: 5 },
29
+ size: { type: Number, default: 18 },
30
+ star: { type: String, default: '★' },
31
+ defaultColor: { type: String, default: '#ccc' },
32
+ activeColor: { type: String, default: '#f5a623' },
33
+ disabled: { type: Boolean, default: false }
34
+ },
35
+ emits: ['update:modelValue'],
36
+ setup (props, { emit }) {
37
+ const currentValue = ref(props.modelValue)
38
+
39
+ // 监听外部 v-model 变化
40
+ watch(
41
+ () => props.modelValue,
42
+ val => {
43
+ currentValue.value = val
44
+ }
45
+ )
46
+
47
+ // 选中星星
48
+ function changeValue (index) {
49
+ if (props.disabled) return
50
+ currentValue.value = index + 1
51
+ emit('update:modelValue', currentValue.value)
52
+ }
53
+
54
+ const classes = computed(() => [prefixCls])
55
+ const starClass = computed(() => [`${prefixCls}-star`])
56
+
57
+ function parentStyles (index) {
58
+ const obj = { fontSize: `${props.size}px` }
59
+ if (index + 1 < props.max) {
60
+ obj.marginRight = `${props.distance}px`
61
+ } else {
62
+ obj.marginRight = '0px'
63
+ }
64
+ obj.color = props.defaultColor
65
+ return obj
66
+ }
67
+
68
+ function childStyles (index) {
69
+ const obj = { fontSize: `${props.size}px` }
70
+ if (index + 1 < props.max) {
71
+ obj.marginRight = `${props.distance}px`
72
+ } else {
73
+ obj.marginRight = '0px'
74
+ }
75
+
76
+ const valueArr = String(currentValue.value).split('.')
77
+ if (index + 1 <= Number(valueArr[0])) {
78
+ obj.color = props.activeColor
79
+ }
80
+
81
+ if (valueArr.length > 1 && Number(valueArr[1]) >= 5 && index + 1 === Number(valueArr[0]) + 1) {
82
+ obj.width = '50%'
83
+ obj.color = props.activeColor
84
+ }
85
+
86
+ return obj
87
+ }
88
+
89
+ return {
90
+ currentValue,
91
+ changeValue,
92
+ classes,
93
+ starClass,
94
+ parentStyles,
95
+ childStyles
96
+ }
97
+ }
98
+ })
99
+ </script>
100
+
101
+ <style lang="less">
102
+ .dpzvc3-rater {
103
+ &-star {
104
+ color: #e9e9e9;
105
+ position: relative;
106
+ display: inline-block;
107
+ > span {
108
+ position: absolute;
109
+ height: 100%;
110
+ content: '★';
111
+ left: 0;
112
+ top: 0;
113
+ color: #e9e9e9;
114
+ overflow: hidden;
115
+ }
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Created by admin on 2017/4/21.
3
+ */
4
+ import SlideBar from './slideBar'
5
+
6
+ export default SlideBar
@@ -0,0 +1,207 @@
1
+ <template>
2
+ <div
3
+ :class="classes"
4
+ :style="getStyles"
5
+ >
6
+ <!-- header -->
7
+ <div
8
+ ref="header"
9
+ :class="headerClasses"
10
+ >
11
+ <div
12
+ ref="wrapper"
13
+ :class="wrapperClasses"
14
+ :style="{ width: isFlex ? 'auto' : items.length * getItemWidth + 'px' }"
15
+ >
16
+ <div
17
+ v-for="(item, key) in items"
18
+ :key="key"
19
+ :class="['dpzvc3-slideBar-child', startIndex === key ? 'active' : '', !isFlex ? 'normalChild' : '']"
20
+ :style="{ textAlign, width: getItemWidth + 'px', height: scrollHeight, lineHeight: scrollHeight }"
21
+ @click="changeBar(key)"
22
+ >
23
+ <slot :name="'slide-bar-header-' + key">
24
+ <a class="content ellipse-fir">{{ item.name }}</a>
25
+ </slot>
26
+ </div>
27
+ </div>
28
+
29
+ <div
30
+ :class="absoluteClass"
31
+ :style="getScrollStyle"
32
+ />
33
+ </div>
34
+
35
+ <!-- content -->
36
+ <div
37
+ :class="containerClass"
38
+ :style="{ height }"
39
+ >
40
+ <div
41
+ ref="content"
42
+ :class="contentClasses"
43
+ :style="getContainerStyle"
44
+ >
45
+ <div
46
+ v-for="(item, index) in items"
47
+ :key="index"
48
+ :class="['dpzvc3-slideBar-content-item', startIndex === index ? 'active' : '']"
49
+ :style="{ width: clientWidth + 'px' }"
50
+ >
51
+ <slot :name="'slot-item-' + index" />
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </template>
57
+
58
+ <script>
59
+ import { defineComponent, ref, computed, onMounted, onBeforeUnmount, nextTick } from 'vue'
60
+
61
+ const prefixCls = 'dpzvc3-slideBar'
62
+
63
+ export default defineComponent({
64
+ name: 'SlideBar',
65
+ props: {
66
+ scrollHeight: { type: [String, Number], default: '30px' },
67
+ height: { type: [String, Number], default: '100%' },
68
+ styles: { type: Object, default: () => ({}) },
69
+ childWidth: { type: Number, default: 70 },
70
+ scrollColor: { type: String, default: '#036eb8' },
71
+ textAlign: { type: String, default: 'center' },
72
+ flex: { type: Boolean, default: true },
73
+ type: { type: String, default: 'normal' },
74
+ list: { type: Array, default: () => [{ name: '1' }, { name: '2' }, { name: '3' }, { name: '4' }] },
75
+ index: { type: Number, default: 0 },
76
+ distanceIndex: { type: Number, default: 1.5 },
77
+ canDrag: { type: Boolean, default: true }
78
+ },
79
+ emits: ['on-change'],
80
+ setup (props, { emit }) {
81
+ const header = ref(null)
82
+ const content = ref(null)
83
+
84
+ const startIndex = ref(props.index)
85
+ const clientWidth = ref(0)
86
+ const dragging = ref(false)
87
+ const distance = ref(0)
88
+ const startTranslateX = ref(0)
89
+ const startX = ref(0)
90
+
91
+ const items = ref(props.list)
92
+ const isFlex = ref(props.flex)
93
+ const fixed = ref(false)
94
+
95
+ const getItemWidth = computed(() => (isFlex.value ? clientWidth.value / items.value.length : props.childWidth))
96
+ const translateX = computed(() => -startIndex.value * clientWidth.value)
97
+
98
+ const classes = computed(() => [prefixCls])
99
+ const headerClasses = computed(() => [prefixCls + '-header', { fixed: fixed.value }])
100
+ const wrapperClasses = computed(() => [
101
+ prefixCls + '-wrapper',
102
+ isFlex.value ? prefixCls + '-flex' : prefixCls + '-slide',
103
+ { normal: props.type === 'normal' && isFlex.value, vertical: props.type === 'vertical' && isFlex.value }
104
+ ])
105
+ const contentClasses = computed(() => [prefixCls + '-content', { [prefixCls + '-dragging']: dragging.value }])
106
+ const absoluteClass = computed(() => [prefixCls + '-wrapper-absolute'])
107
+ const containerClass = computed(() => [prefixCls + '-container'])
108
+ const getStyles = computed(() => ({ ...props.styles }))
109
+ const getContainerStyle = computed(() => ({
110
+ width: clientWidth.value * items.value.length + 'px',
111
+ transform: `translate3d(${translateX.value}px,0,0)`
112
+ }))
113
+ const getScrollStyle = computed(() => ({
114
+ width: getItemWidth.value + 'px',
115
+ transform: `translate3d(${startIndex.value * getItemWidth.value}px,0,0)`,
116
+ backgroundColor: props.scrollColor
117
+ }))
118
+ const maxIndex = computed(() => items.value.length - 1)
119
+
120
+ // tab 切换
121
+ function changeBar (index) {
122
+ if (startIndex.value === index) return
123
+ startIndex.value = index
124
+ emit('on-change', index)
125
+ }
126
+
127
+ // 拖拽事件
128
+ function onTouchStart (e) {
129
+ startTranslateX.value = translateX.value
130
+ distance.value = 0
131
+ startX.value = e.touches[0].clientX
132
+ dragging.value = true
133
+ }
134
+ function onTouchMove (e) {
135
+ const currentX = e.touches[0].clientX
136
+ distance.value = props.distanceIndex ? (currentX - startX.value) / props.distanceIndex : currentX - startX.value
137
+ }
138
+ function onTouchEnd () {
139
+ if (distance.value < 0 && Math.abs(distance.value) > clientWidth.value / 2) {
140
+ slideLeft()
141
+ } else if (distance.value > 0 && Math.abs(distance.value) > clientWidth.value / 2) {
142
+ slideRight()
143
+ }
144
+ dragging.value = false
145
+ }
146
+ function slideLeft () {
147
+ if (startIndex.value < maxIndex.value) startIndex.value++
148
+ emit('on-change', startIndex.value)
149
+ }
150
+ function slideRight () {
151
+ if (startIndex.value > 0) startIndex.value--
152
+ emit('on-change', startIndex.value)
153
+ }
154
+
155
+ // 固定 header
156
+ function onScroll () {
157
+ fixed.value = header.value.getBoundingClientRect().top <= 0
158
+ }
159
+ function onResize () {
160
+ clientWidth.value = header.value.clientWidth
161
+ }
162
+
163
+ onMounted(() => {
164
+ clientWidth.value = header.value.clientWidth
165
+ window.addEventListener('resize', onResize)
166
+ if (props.canDrag && content.value) {
167
+ content.value.addEventListener('touchstart', onTouchStart)
168
+ content.value.addEventListener('touchmove', onTouchMove)
169
+ content.value.addEventListener('touchend', onTouchEnd)
170
+ }
171
+ })
172
+
173
+ onBeforeUnmount(() => {
174
+ window.removeEventListener('resize', onResize)
175
+ if (props.canDrag && content.value) {
176
+ content.value.removeEventListener('touchstart', onTouchStart)
177
+ content.value.removeEventListener('touchmove', onTouchMove)
178
+ content.value.removeEventListener('touchend', onTouchEnd)
179
+ }
180
+ })
181
+
182
+ return {
183
+ header,
184
+ content,
185
+ startIndex,
186
+ clientWidth,
187
+ dragging,
188
+ distance,
189
+ items,
190
+ isFlex,
191
+ fixed,
192
+ getItemWidth,
193
+ translateX,
194
+ classes,
195
+ headerClasses,
196
+ wrapperClasses,
197
+ contentClasses,
198
+ absoluteClass,
199
+ containerClass,
200
+ getStyles,
201
+ getContainerStyle,
202
+ getScrollStyle,
203
+ changeBar
204
+ }
205
+ }
206
+ })
207
+ </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div
3
+ class="dpzvc3-spinner-blade"
4
+ :style="spinnerStyle"
5
+ >
6
+ <div
7
+ v-for="i in 12"
8
+ :key="i"
9
+ class="blade"
10
+ :class="'blade-' + i"
11
+ :style="bladeStyle"
12
+ />
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import { defineComponent, computed } from 'vue'
18
+ import spinnerProps from '../props' // 复用 spinnerProps
19
+ // 如果原来 mixins props 是这样
20
+ // {
21
+ // color: String,
22
+ // size: [Number, String]
23
+ // }
24
+
25
+ export default defineComponent({
26
+ name: 'Dpzvc3Blade',
27
+ props: spinnerProps.props,
28
+ setup (props) {
29
+ // 计算每个 blade 的样式
30
+ const bladeStyle = computed(() => {
31
+ return props.color ? { backgroundColor: props.color } : {}
32
+ })
33
+ const { spinnerStyle } = spinnerProps.setup(props)
34
+ // console.log(spinnerStyle, 'ddds')
35
+ // 如果需要设置整个 spinner 容器的大小
36
+ return {
37
+ bladeStyle,
38
+ spinnerStyle
39
+ }
40
+ }
41
+ })
42
+ </script>