dpzvc3-ui 3.1.4 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/dpzvc3.esm.js +5 -4
- package/dist/dpzvc3.esm.js.map +1 -1
- package/dist/dpzvc3.esm.min.js +1 -1
- package/dist/dpzvc3.esm.min.js.map +1 -1
- package/dist/dpzvc3.js +5 -4
- package/dist/dpzvc3.js.map +1 -1
- package/dist/dpzvc3.min.js +1 -1
- package/dist/dpzvc3.min.js.map +1 -1
- package/dist/types/components/actionSheet/index.d.ts +6 -1
- package/dist/types/components/actionSheet/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +7 -2
- package/build-style.js +0 -58
- package/dist-prod/91.05c8ec5277a15f939b0f.js +0 -3
- package/dist-prod/91.05c8ec5277a15f939b0f.js.LICENSE.txt +0 -25
- package/dist-prod/91.05c8ec5277a15f939b0f.js.map +0 -1
- package/dist-prod/actionsheet.0d67b6b08a62cf9360be.chunk.js +0 -2
- package/dist-prod/actionsheet.0d67b6b08a62cf9360be.chunk.js.map +0 -1
- package/dist-prod/badge.16ab5c05734fe1530701.chunk.js +0 -2
- package/dist-prod/badge.16ab5c05734fe1530701.chunk.js.map +0 -1
- package/dist-prod/button.39ac33aa7aaccc24b6a1.chunk.js +0 -2
- package/dist-prod/button.39ac33aa7aaccc24b6a1.chunk.js.map +0 -1
- package/dist-prod/card.16ed7eafe471bcc60ec6.chunk.js +0 -2
- package/dist-prod/card.16ed7eafe471bcc60ec6.chunk.js.map +0 -1
- package/dist-prod/cell.70ff74fba57e27df7f5a.chunk.js +0 -2
- package/dist-prod/cell.70ff74fba57e27df7f5a.chunk.js.map +0 -1
- package/dist-prod/cellswipe.f3ec62abd60729d8bc5a.chunk.js +0 -2
- package/dist-prod/cellswipe.f3ec62abd60729d8bc5a.chunk.js.map +0 -1
- package/dist-prod/checkbox.05c63a947ac98293c9f2.chunk.js +0 -2
- package/dist-prod/checkbox.05c63a947ac98293c9f2.chunk.js.map +0 -1
- package/dist-prod/guide.24f1968a568f20fbc84b.chunk.js +0 -2
- package/dist-prod/guide.24f1968a568f20fbc84b.chunk.js.map +0 -1
- package/dist-prod/header.eb10433dd892738ee95a.chunk.js +0 -2
- package/dist-prod/header.eb10433dd892738ee95a.chunk.js.map +0 -1
- package/dist-prod/index.html +0 -19
- package/dist-prod/indicator.0c09e3f238791cb478e0.chunk.js +0 -2
- package/dist-prod/indicator.0c09e3f238791cb478e0.chunk.js.map +0 -1
- package/dist-prod/loadmore.9bad88767cc43603f473.chunk.js +0 -2
- package/dist-prod/loadmore.9bad88767cc43603f473.chunk.js.map +0 -1
- package/dist-prod/main.662ad15361e7f3d20234.js +0 -2
- package/dist-prod/main.662ad15361e7f3d20234.js.map +0 -1
- package/dist-prod/message.de17fea3de4daa70bab4.chunk.js +0 -2
- package/dist-prod/message.de17fea3de4daa70bab4.chunk.js.map +0 -1
- package/dist-prod/modal.f9ec857acd9fbdf53f3b.chunk.js +0 -2
- package/dist-prod/modal.f9ec857acd9fbdf53f3b.chunk.js.map +0 -1
- package/dist-prod/picker.bca059ef59e3c42a401f.chunk.js +0 -2
- package/dist-prod/picker.bca059ef59e3c42a401f.chunk.js.map +0 -1
- package/dist-prod/popup.538422c7e188363a468d.chunk.js +0 -2
- package/dist-prod/popup.538422c7e188363a468d.chunk.js.map +0 -1
- package/dist-prod/progress.240de4b633002f573030.chunk.js +0 -2
- package/dist-prod/progress.240de4b633002f573030.chunk.js.map +0 -1
- package/dist-prod/prompt.dcda0b05ea02d59106b7.chunk.js +0 -2
- package/dist-prod/prompt.dcda0b05ea02d59106b7.chunk.js.map +0 -1
- package/dist-prod/radiobox.7c10f77aba5ae04b2e5c.chunk.js +0 -2
- package/dist-prod/radiobox.7c10f77aba5ae04b2e5c.chunk.js.map +0 -1
- package/dist-prod/rater.d46ae462c598c458e5a8.chunk.js +0 -2
- package/dist-prod/rater.d46ae462c598c458e5a8.chunk.js.map +0 -1
- package/dist-prod/slidebar.833e75b9eb0abef92453.chunk.js +0 -2
- package/dist-prod/slidebar.833e75b9eb0abef92453.chunk.js.map +0 -1
- package/dist-prod/spinner.6afb4f84cc29f0e2f8eb.chunk.js +0 -2
- package/dist-prod/spinner.6afb4f84cc29f0e2f8eb.chunk.js.map +0 -1
- package/dist-prod/swipe.3fe6ee6638765ec52d94.chunk.js +0 -2
- package/dist-prod/swipe.3fe6ee6638765ec52d94.chunk.js.map +0 -1
- package/dist-prod/switchbar.f24c76a03120f1bd961a.chunk.js +0 -2
- package/dist-prod/switchbar.f24c76a03120f1bd961a.chunk.js.map +0 -1
- package/dist-prod/tab.29f19483f699b7811259.chunk.js +0 -2
- package/dist-prod/tab.29f19483f699b7811259.chunk.js.map +0 -1
- package/dist-prod/text.a6e4251f772d23843e2b.chunk.js +0 -2
- package/dist-prod/text.a6e4251f772d23843e2b.chunk.js.map +0 -1
- package/dist-prod/totop.713c5ab7f7dbcffbf2a3.chunk.js +0 -2
- package/dist-prod/totop.713c5ab7f7dbcffbf2a3.chunk.js.map +0 -1
- package/dist-prod/upload.0638581e551ed9afaba2.chunk.js +0 -2
- package/dist-prod/upload.0638581e551ed9afaba2.chunk.js.map +0 -1
- package/postcss.config.js +0 -5
- package/src/components/Indicator/Indicator.tsx +0 -67
- package/src/components/Indicator/Indicator.vue +0 -82
- package/src/components/Indicator/index.ts +0 -111
- package/src/components/Indicator/types.ts +0 -15
- package/src/components/Text/index.ts +0 -14
- package/src/components/Text/textBar.tsx +0 -104
- package/src/components/Text/types.ts +0 -13
- package/src/components/actionSheet/actionSheet.d.ts +0 -16
- package/src/components/actionSheet/actionSheet.tsx +0 -86
- package/src/components/actionSheet/index.ts +0 -6
- package/src/components/actionSheet/types.ts +0 -10
- package/src/components/app.vue +0 -59
- package/src/components/badge/badge.tsx +0 -80
- package/src/components/badge/index.ts +0 -12
- package/src/components/badge/types.ts +0 -8
- package/src/components/button/button.tsx +0 -105
- package/src/components/button/index.ts +0 -13
- package/src/components/button/types.ts +0 -13
- package/src/components/card/card.d.ts +0 -16
- package/src/components/card/card.tsx +0 -38
- package/src/components/card/index.ts +0 -12
- package/src/components/card/types.ts +0 -3
- package/src/components/cell/cell.tsx +0 -89
- package/src/components/cell/index.ts +0 -12
- package/src/components/cell/types.ts +0 -8
- package/src/components/cellSwipe/cellSwipe.tsx +0 -188
- package/src/components/cellSwipe/index.ts +0 -13
- package/src/components/cellSwipe/types.ts +0 -17
- package/src/components/checkBox/checkbox-group.tsx +0 -75
- package/src/components/checkBox/checkbox.tsx +0 -107
- package/src/components/checkBox/index.ts +0 -29
- package/src/components/checkBox/types.ts +0 -32
- package/src/components/header/header.tsx +0 -119
- package/src/components/header/index.ts +0 -13
- package/src/components/header/types.ts +0 -7
- package/src/components/loadMore/index.ts +0 -14
- package/src/components/loadMore/loadMore.tsx +0 -265
- package/src/components/loadMore/types.ts +0 -26
- package/src/components/message/confirm.ts +0 -104
- package/src/components/message/index.ts +0 -113
- package/src/components/message/message.tsx +0 -100
- package/src/components/message/messageGroup.tsx +0 -59
- package/src/components/message/types.ts +0 -48
- package/src/components/modal/confirm.ts +0 -123
- package/src/components/modal/index.ts +0 -68
- package/src/components/modal/modal.tsx +0 -248
- package/src/components/modal/types.ts +0 -51
- package/src/components/number/Number.tsx +0 -143
- package/src/components/number/index.ts +0 -10
- package/src/components/number/types.ts +0 -13
- package/src/components/picker/area-picker/area-picker.vue +0 -230
- package/src/components/picker/area-picker/props.js +0 -17
- package/src/components/picker/date-picker/date-picker.vue +0 -191
- package/src/components/picker/date-picker/props.js +0 -24
- package/src/components/picker/index.ts +0 -12
- package/src/components/picker/normal-picker/normal-picker.vue +0 -120
- package/src/components/picker/normal-picker/props.js +0 -20
- package/src/components/picker/picker-slot.vue +0 -217
- package/src/components/picker/picker.tsx +0 -112
- package/src/components/picker/types.ts +0 -17
- package/src/components/popup/index.ts +0 -12
- package/src/components/popup/popup.d.ts +0 -16
- package/src/components/popup/popup.tsx +0 -68
- package/src/components/popup/types.ts +0 -9
- package/src/components/progress/index.ts +0 -12
- package/src/components/progress/progress.tsx +0 -81
- package/src/components/progress/types.ts +0 -9
- package/src/components/prompt/confirm.ts +0 -104
- package/src/components/prompt/index.ts +0 -50
- package/src/components/prompt/prompt.tsx +0 -161
- package/src/components/prompt/types.ts +0 -45
- package/src/components/radioBox/index.ts +0 -34
- package/src/components/radioBox/radiobox-group.tsx +0 -66
- package/src/components/radioBox/radiobox-group1.vue +0 -66
- package/src/components/radioBox/radiobox.tsx +0 -115
- package/src/components/radioBox/radiobox1.vue +0 -89
- package/src/components/radioBox/types.ts +0 -24
- package/src/components/rater/index.ts +0 -12
- package/src/components/rater/rater.d.ts +0 -16
- package/src/components/rater/raters.tsx +0 -101
- package/src/components/rater/types.ts +0 -10
- package/src/components/slideBar/index.ts +0 -13
- package/src/components/slideBar/slideBar.tsx +0 -288
- package/src/components/slideBar/types.ts +0 -20
- package/src/components/spinner/behavior/blade.vue +0 -42
- package/src/components/spinner/behavior/double-bounce.vue +0 -38
- package/src/components/spinner/behavior/fading-circle.vue +0 -55
- package/src/components/spinner/behavior/snake.vue +0 -41
- package/src/components/spinner/behavior/triple-bounce.vue +0 -52
- package/src/components/spinner/index.ts +0 -13
- package/src/components/spinner/props.js +0 -28
- package/src/components/spinner/spinner.tsx +0 -85
- package/src/components/spinner/types.ts +0 -20
- package/src/components/swipe/index.ts +0 -13
- package/src/components/swipe/swipe.tsx +0 -292
- package/src/components/swipe/types.ts +0 -21
- package/src/components/switchbar/index.ts +0 -13
- package/src/components/switchbar/switchbar.tsx +0 -58
- package/src/components/switchbar/types.ts +0 -6
- package/src/components/tab/index.ts +0 -12
- package/src/components/tab/tab.tsx +0 -71
- package/src/components/tab/types.ts +0 -15
- package/src/components/toTop/index.ts +0 -13
- package/src/components/toTop/toTop.tsx +0 -54
- package/src/components/toTop/types.ts +0 -7
- package/src/components/upload/index.ts +0 -13
- package/src/components/upload/types.ts +0 -9
- package/src/components/upload/upload.tsx +0 -180
- package/src/config/config.js +0 -16
- package/src/directives/clickoutside.js +0 -42
- package/src/directives/tranferDom.js +0 -66
- package/src/index.d.ts +0 -131
- package/src/index.ts +0 -136
- package/src/lib/MegaPixImage.js +0 -164
- package/src/lib/MegaPixImageOld.js +0 -153
- package/src/lib/exif-js.js +0 -235
- package/src/lib/exif.js +0 -789
- package/src/lib/lib.js +0 -22
- package/src/main.ts +0 -33
- package/src/mixin/emitter.js +0 -72
- package/src/mixin/input.js +0 -41
- package/src/router.ts +0 -36
- package/src/shims-vue.d.ts +0 -37
- package/src/styles/base/font.less +0 -99
- package/src/styles/base/reset.less +0 -135
- package/src/styles/base/variable.less +0 -108
- package/src/styles/components/actionSheet.less +0 -43
- package/src/styles/components/badge.less +0 -81
- package/src/styles/components/button.less +0 -124
- package/src/styles/components/card.less +0 -31
- package/src/styles/components/cell-swipe.less +0 -20
- package/src/styles/components/cell.less +0 -75
- package/src/styles/components/checkBox.less +0 -113
- package/src/styles/components/editor.less +0 -3
- package/src/styles/components/header.less +0 -72
- package/src/styles/components/indicator.less +0 -39
- package/src/styles/components/loadmore.less +0 -48
- package/src/styles/components/message.less +0 -57
- package/src/styles/components/modal.less +0 -84
- package/src/styles/components/number.less +0 -60
- package/src/styles/components/picker.less +0 -152
- package/src/styles/components/popup.less +0 -46
- package/src/styles/components/progress.less +0 -52
- package/src/styles/components/prompt.less +0 -37
- package/src/styles/components/radioBox.less +0 -142
- package/src/styles/components/rater.less +0 -16
- package/src/styles/components/slide-Bar.less +0 -149
- package/src/styles/components/spinner.less +0 -329
- package/src/styles/components/swipe.less +0 -125
- package/src/styles/components/switchBar.less +0 -88
- package/src/styles/components/tab.less +0 -71
- package/src/styles/components/text.less +0 -82
- package/src/styles/components/toTop.less +0 -28
- package/src/styles/components/upload.less +0 -23
- package/src/styles/index.less +0 -39
- package/src/styles/utils/1px.less +0 -206
- package/src/styles/utils/animation.less +0 -165
- package/src/styles/utils/nowrap.less +0 -19
- package/src/template/index.ejs +0 -40
- package/src/types/index.d.ts +0 -127
- package/src/types/js-shims.d.ts +0 -36
- package/src/utils/test.ts +0 -2
- package/src/utils/util.ts +0 -168
- package/src/utils/util1.js +0 -202
- package/src/vconsole-resources.min.js +0 -6
- package/src/vconsole-sources.min.js +0 -6
- package/src/vconsole.min.js +0 -7
- package/src/views/ActionSheet.vue +0 -46
- package/src/views/Badge/Badge.less +0 -12
- package/src/views/Badge/Badge.tsx +0 -23
- package/src/views/Badge.vue +0 -53
- package/src/views/Button.vue +0 -69
- package/src/views/Card.vue +0 -89
- package/src/views/Cell.vue +0 -31
- package/src/views/CellSwipe.vue +0 -80
- package/src/views/CheckBox.vue +0 -78
- package/src/views/Header.vue +0 -71
- package/src/views/Indicator.vue +0 -82
- package/src/views/LoadMore.vue +0 -76
- package/src/views/Message.vue +0 -61
- package/src/views/Modal.vue +0 -69
- package/src/views/Picker.vue +0 -142
- package/src/views/Popup.vue +0 -103
- package/src/views/Progress.vue +0 -49
- package/src/views/Prompt.vue +0 -43
- package/src/views/RadioBox.vue +0 -70
- package/src/views/Rater.vue +0 -53
- package/src/views/SlideBar.vue +0 -62
- package/src/views/Spinner.vue +0 -27
- package/src/views/Swipe.vue +0 -59
- package/src/views/SwitchBar.vue +0 -49
- package/src/views/Tab.vue +0 -55
- package/src/views/Text.vue +0 -97
- package/src/views/ToTop.vue +0 -31
- package/src/views/Upload.vue +0 -65
- package/src/views/guide.vue +0 -164
- package/src/views/index.vue +0 -554
- package/tsconfig.build.json +0 -31
- package/tsconfig.json +0 -41
- package/webpack.base.config.js +0 -85
- package/webpack.dev.config.js +0 -43
- package/webpack.dist.dev.config.js +0 -76
- package/webpack.dist.prod.config.js +0 -90
- package/webpack.prod.config.js +0 -52
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
// src/components/upload/upload.tsx
|
|
2
|
-
import {
|
|
3
|
-
defineComponent,
|
|
4
|
-
ref,
|
|
5
|
-
computed,
|
|
6
|
-
watch,
|
|
7
|
-
getCurrentInstance,
|
|
8
|
-
PropType
|
|
9
|
-
} from 'vue'
|
|
10
|
-
import exifr from 'exifr'
|
|
11
|
-
import MegaPixImage from '../../lib/MegaPixImage'
|
|
12
|
-
import { JPEG } from '../../utils/util'
|
|
13
|
-
import type { UploadProps } from './types'
|
|
14
|
-
|
|
15
|
-
export type { UploadProps }
|
|
16
|
-
|
|
17
|
-
const prefixCls = 'dpzvc3-upload'
|
|
18
|
-
|
|
19
|
-
export default defineComponent({
|
|
20
|
-
name: 'Dpzvc3Upload',
|
|
21
|
-
|
|
22
|
-
props: {
|
|
23
|
-
multiple: {
|
|
24
|
-
type: Boolean as PropType<boolean>,
|
|
25
|
-
default: false
|
|
26
|
-
},
|
|
27
|
-
accept: {
|
|
28
|
-
type: String as PropType<string>,
|
|
29
|
-
default: 'image/*'
|
|
30
|
-
},
|
|
31
|
-
styles: {
|
|
32
|
-
type: Object as PropType<Record<string, any>>,
|
|
33
|
-
default: () => ({})
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
emits: ['on-change-file'],
|
|
38
|
-
|
|
39
|
-
setup(props: UploadProps, { emit, slots }) {
|
|
40
|
-
const { proxy } = getCurrentInstance()!
|
|
41
|
-
|
|
42
|
-
const files = ref<any[]>([])
|
|
43
|
-
const fileLength = ref(0)
|
|
44
|
-
const uploadRef = ref<HTMLInputElement | null>(null)
|
|
45
|
-
|
|
46
|
-
const classes = computed(() => [prefixCls])
|
|
47
|
-
const wrapperClasses = computed(() => [`${prefixCls}-wrapper`])
|
|
48
|
-
|
|
49
|
-
watch(files, (val) => {
|
|
50
|
-
emit('on-change-file', val)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const showPhoto = async (e: Event) => {
|
|
54
|
-
const input = e.target as HTMLInputElement
|
|
55
|
-
const fileList = input.files
|
|
56
|
-
if (!fileList || !proxy) return
|
|
57
|
-
|
|
58
|
-
(proxy as any).$Indicator?.snake({ text: '上传中' })
|
|
59
|
-
|
|
60
|
-
files.value = []
|
|
61
|
-
fileLength.value = fileList.length
|
|
62
|
-
|
|
63
|
-
for (let i = 0; i < fileList.length; i++) {
|
|
64
|
-
const file = fileList[i]
|
|
65
|
-
try {
|
|
66
|
-
const orientation = await exifr.orientation(file)
|
|
67
|
-
|
|
68
|
-
const dataURL = await new Promise<string>((resolve, reject) => {
|
|
69
|
-
const reader = new FileReader()
|
|
70
|
-
reader.readAsDataURL(file)
|
|
71
|
-
reader.onload = () => resolve(reader.result as string)
|
|
72
|
-
reader.onerror = reject
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
const img = new Image()
|
|
76
|
-
img.src = dataURL
|
|
77
|
-
|
|
78
|
-
await new Promise<void>((resolve) => {
|
|
79
|
-
img.onload = () => {
|
|
80
|
-
create(img, orientation)
|
|
81
|
-
resolve()
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
} catch (err) {
|
|
85
|
-
console.error('读取图片失败', err)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
input.value = ''
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const create = (file: HTMLImageElement, orientation?: number) => {
|
|
93
|
-
const img = new Image()
|
|
94
|
-
const mpImg = new MegaPixImage(file)
|
|
95
|
-
|
|
96
|
-
mpImg.render(img, { maxWidth: 600, quality: 0.8 })
|
|
97
|
-
|
|
98
|
-
img.onload = () => {
|
|
99
|
-
const canvas = document.createElement('canvas')
|
|
100
|
-
const ctx = canvas.getContext('2d')!
|
|
101
|
-
canvas.width = img.width
|
|
102
|
-
canvas.height = img.height
|
|
103
|
-
ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
|
|
104
|
-
|
|
105
|
-
let data = canvas.toDataURL('image/jpeg', 0.8)
|
|
106
|
-
|
|
107
|
-
if (/iphone/i.test(navigator.userAgent) && orientation && orientation !== 1) {
|
|
108
|
-
rotateImg(img, orientation, canvas)
|
|
109
|
-
data = canvas.toDataURL('image/jpeg', 0.8)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (/android/i.test(navigator.userAgent)) {
|
|
113
|
-
const encoder = new JPEG.JPEGEncoder()
|
|
114
|
-
data = encoder.encode(
|
|
115
|
-
ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
116
|
-
80
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
files.value.push({
|
|
121
|
-
base64: data,
|
|
122
|
-
clearBase64: data.slice(data.indexOf(',') + 1)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
if (files.value.length === fileLength.value) {
|
|
126
|
-
(proxy as any).$Indicator?.remove()
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const rotateImg = (
|
|
132
|
-
img: HTMLImageElement,
|
|
133
|
-
orientation: number,
|
|
134
|
-
canvas: HTMLCanvasElement
|
|
135
|
-
) => {
|
|
136
|
-
const ctx = canvas.getContext('2d')!
|
|
137
|
-
const width = img.width
|
|
138
|
-
const height = img.height
|
|
139
|
-
|
|
140
|
-
switch (orientation) {
|
|
141
|
-
case 6:
|
|
142
|
-
canvas.width = height
|
|
143
|
-
canvas.height = width
|
|
144
|
-
ctx.rotate(Math.PI / 2)
|
|
145
|
-
ctx.drawImage(img, 0, -height)
|
|
146
|
-
break
|
|
147
|
-
case 8:
|
|
148
|
-
canvas.width = height
|
|
149
|
-
canvas.height = width
|
|
150
|
-
ctx.rotate(-Math.PI / 2)
|
|
151
|
-
ctx.drawImage(img, -width, 0)
|
|
152
|
-
break
|
|
153
|
-
case 3:
|
|
154
|
-
canvas.width = width
|
|
155
|
-
canvas.height = height
|
|
156
|
-
ctx.rotate(Math.PI)
|
|
157
|
-
ctx.drawImage(img, -width, -height)
|
|
158
|
-
break
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return () => (
|
|
163
|
-
<div class={classes.value} style={props.styles}>
|
|
164
|
-
{slots.default ? (
|
|
165
|
-
slots.default()
|
|
166
|
-
) : (
|
|
167
|
-
<div class={wrapperClasses.value}>图片上传</div>
|
|
168
|
-
)}
|
|
169
|
-
|
|
170
|
-
<input
|
|
171
|
-
ref={uploadRef}
|
|
172
|
-
type="file"
|
|
173
|
-
accept={props.accept}
|
|
174
|
-
multiple={props.multiple}
|
|
175
|
-
onChange={showPhoto}
|
|
176
|
-
/>
|
|
177
|
-
</div>
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
})
|
package/src/config/config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
// src/types/index.d.ts
|
|
2
|
-
|
|
3
|
-
/* ----------------------------------
|
|
4
|
-
* 1️⃣ 按需导出组件 & props(给 TS import 用)
|
|
5
|
-
* ---------------------------------- */
|
|
6
|
-
export { default as Badge } from './components/badge'
|
|
7
|
-
export type { BadgeProps } from './components/badge/types'
|
|
8
|
-
|
|
9
|
-
export { default as Popup } from './components/popup'
|
|
10
|
-
export type { PopupProps } from './components/popup/types'
|
|
11
|
-
|
|
12
|
-
export { default as ActionSheet } from './components/actionSheet'
|
|
13
|
-
export type { ActionSheetProps } from './components/actionSheet/types'
|
|
14
|
-
|
|
15
|
-
export { default as Card } from './components/card'
|
|
16
|
-
export type { CardProps } from './components/card/types'
|
|
17
|
-
|
|
18
|
-
export { default as Rater } from './components/rater'
|
|
19
|
-
export type { RaterProps } from './components/rater/types'
|
|
20
|
-
|
|
21
|
-
export { default as Cell } from './components/cell'
|
|
22
|
-
export type { CellProps } from './components/cell/types'
|
|
23
|
-
|
|
24
|
-
export { default as CellSwipe } from './components/cellSwipe'
|
|
25
|
-
export type { CellSwipeProps } from './components/cellSwipe/types'
|
|
26
|
-
|
|
27
|
-
export { default as DpHeader } from './components/header'
|
|
28
|
-
export type { HeaderProps } from './components/header/types'
|
|
29
|
-
|
|
30
|
-
export { default as Spinner } from './components/spinner'
|
|
31
|
-
export type { SpinnerProps } from './components/spinner/types'
|
|
32
|
-
|
|
33
|
-
export { default as Swipe } from './components/swipe'
|
|
34
|
-
export type { SwipeProps } from './components/swipe/types'
|
|
35
|
-
|
|
36
|
-
export { default as DpButton } from './components/button'
|
|
37
|
-
export type { ButtonProps } from './components/button/types'
|
|
38
|
-
|
|
39
|
-
export { default as Picker } from './components/picker'
|
|
40
|
-
export type { PickerProps } from './components/picker/types'
|
|
41
|
-
|
|
42
|
-
export { default as SwitchBar } from './components/switchbar'
|
|
43
|
-
export type { SwitchBarProps } from './components/switchbar/types'
|
|
44
|
-
|
|
45
|
-
export { default as Tab } from './components/tab'
|
|
46
|
-
export type { TabProps } from './components/tab/types'
|
|
47
|
-
|
|
48
|
-
export { default as TextBar } from './components/Text'
|
|
49
|
-
export type { TextBarProps } from './components/Text/types'
|
|
50
|
-
|
|
51
|
-
export { default as Number } from './components/number'
|
|
52
|
-
export type { NumberProps } from './components/number/types'
|
|
53
|
-
|
|
54
|
-
export { default as ToTop } from './components/toTop'
|
|
55
|
-
export type { ToTopProps } from './components/toTop/types'
|
|
56
|
-
|
|
57
|
-
export { default as Upload } from './components/upload'
|
|
58
|
-
export type { UploadProps } from './components/upload/types'
|
|
59
|
-
|
|
60
|
-
export { default as SlideBar } from './components/slideBar'
|
|
61
|
-
export type { SlideBarProps } from './components/slideBar/types'
|
|
62
|
-
|
|
63
|
-
export { default as DpProgress } from './components/progress'
|
|
64
|
-
export type { ProgressProps } from './components/progress/types'
|
|
65
|
-
|
|
66
|
-
export { default as DpLoadMore } from './components/loadMore'
|
|
67
|
-
export type { LoadmoreProps } from './components/loadMore/types'
|
|
68
|
-
|
|
69
|
-
export { default as CheckBox, default as CheckBoxGroup } from './components/checkBox'
|
|
70
|
-
export type { CheckBoxProps, CheckBoxGroupProps } from './components/checkBox/types'
|
|
71
|
-
|
|
72
|
-
export { default as RadioBox, default as RadioBoxGroup } from './components/radioBox'
|
|
73
|
-
export type { RadioBoxProps, RadioGroupProps } from './components/radioBox/types'
|
|
74
|
-
|
|
75
|
-
/* ----------------------------------
|
|
76
|
-
* 2️⃣ 全局组件声明(给 <template> 用)
|
|
77
|
-
* ---------------------------------- */
|
|
78
|
-
import type { App } from 'vue'
|
|
79
|
-
import type { ModalInstance } from './components/modal/types'
|
|
80
|
-
import type { MessageInstance } from './components/message/types'
|
|
81
|
-
import type { IndicatorInstance } from './components/Indicator/types'
|
|
82
|
-
import type { PromptInstance } from './components/prompt/types'
|
|
83
|
-
|
|
84
|
-
declare module 'vue' {
|
|
85
|
-
interface ComponentCustomProperties {
|
|
86
|
-
$Modal: ModalInstance
|
|
87
|
-
$Message: MessageInstance
|
|
88
|
-
$Indicator: IndicatorInstance
|
|
89
|
-
$Prompt: PromptInstance
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface GlobalComponents {
|
|
93
|
-
Badge: typeof import('./components/badge')['default']
|
|
94
|
-
Popup: typeof import('./components/popup')['default']
|
|
95
|
-
ActionSheet: typeof import('./components/actionSheet')['default']
|
|
96
|
-
Card: typeof import('./components/card')['default']
|
|
97
|
-
Rater: typeof import('./components/rater')['default']
|
|
98
|
-
Cell: typeof import('./components/cell')['default']
|
|
99
|
-
CellSwipe: typeof import('./components/cellSwipe')['default']
|
|
100
|
-
DpHeader: typeof import('./components/header')['default']
|
|
101
|
-
Spinner: typeof import('./components/spinner')['default']
|
|
102
|
-
Swipe: typeof import('./components/swipe')['default']
|
|
103
|
-
DpButton: typeof import('./components/button')['default']
|
|
104
|
-
Picker: typeof import('./components/picker')['default']
|
|
105
|
-
SwitchBar: typeof import('./components/switchbar')['default']
|
|
106
|
-
Tab: typeof import('./components/tab')['default']
|
|
107
|
-
TextBar: typeof import('./components/Text')['default']
|
|
108
|
-
Number: typeof import('./components/number')['default']
|
|
109
|
-
ToTop: typeof import('./components/toTop')['default']
|
|
110
|
-
Upload: typeof import('./components/upload')['default']
|
|
111
|
-
SlideBar: typeof import('./components/slideBar')['default']
|
|
112
|
-
DpProgress: typeof import('./components/progress')['default']
|
|
113
|
-
DpLoadMore: typeof import('./components/loadMore')['default']
|
|
114
|
-
CheckBox: typeof import('./components/checkBox')['CheckBox']
|
|
115
|
-
CheckBoxGroup: typeof import('./components/checkBox')['CheckBoxGroup']
|
|
116
|
-
RadioBox: typeof import('./components/radioBox')['RadioBox']
|
|
117
|
-
RadioBoxGroup: typeof import('./components/radioBox')['RadioBoxGroup']
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* ----------------------------------
|
|
122
|
-
* 3️⃣ 默认导出整个组件库为 Vue 插件
|
|
123
|
-
* ---------------------------------- */
|
|
124
|
-
import type { Plugin } from 'vue'
|
|
125
|
-
export const Dpzvc3UI: Plugin
|
|
126
|
-
export default Dpzvc3UI
|
|
127
|
-
|
|
128
|
-
/* ----------------------------------
|
|
129
|
-
* 4️⃣ 保证这是 module
|
|
130
|
-
* ---------------------------------- */
|
|
131
|
-
export {}
|
package/src/index.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue 3 组件库入口 ts 版本
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { App, Plugin } from 'vue'
|
|
6
|
-
|
|
7
|
-
/* ========= 组件引入 ========= */
|
|
8
|
-
import DpButton from './components/button'
|
|
9
|
-
import { CheckBox, CheckBoxGroup } 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, RadioBoxGroup } 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/actionSheet'
|
|
22
|
-
import SwitchBar from './components/switchbar'
|
|
23
|
-
import Rater from './components/rater'
|
|
24
|
-
import Spinner from './components/spinner'
|
|
25
|
-
import DpLoadMore 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/cellSwipe'
|
|
32
|
-
import Badge from './components/badge'
|
|
33
|
-
import Card from './components/card'
|
|
34
|
-
import Number from './components/number'
|
|
35
|
-
|
|
36
|
-
/* ========= 组件集合 ========= */
|
|
37
|
-
const components = {
|
|
38
|
-
DpButton,
|
|
39
|
-
CheckBox,
|
|
40
|
-
CheckBoxGroup,
|
|
41
|
-
RadioBox,
|
|
42
|
-
RadioBoxGroup,
|
|
43
|
-
DpHeader,
|
|
44
|
-
Picker,
|
|
45
|
-
Swipe,
|
|
46
|
-
Tab,
|
|
47
|
-
SlideBar,
|
|
48
|
-
TextBar,
|
|
49
|
-
Number,
|
|
50
|
-
Upload,
|
|
51
|
-
ActionSheet,
|
|
52
|
-
SwitchBar,
|
|
53
|
-
Rater,
|
|
54
|
-
Spinner,
|
|
55
|
-
DpLoadMore,
|
|
56
|
-
Popup,
|
|
57
|
-
DpProgress: Progress,
|
|
58
|
-
ToTop,
|
|
59
|
-
Cell,
|
|
60
|
-
CellSwipe,
|
|
61
|
-
Badge,
|
|
62
|
-
Card
|
|
63
|
-
} as const
|
|
64
|
-
|
|
65
|
-
/* ========= 服务组件 ========= */
|
|
66
|
-
const services = {
|
|
67
|
-
Message,
|
|
68
|
-
Modal,
|
|
69
|
-
Prompt,
|
|
70
|
-
Indicator
|
|
71
|
-
} as const
|
|
72
|
-
|
|
73
|
-
/* ========= 遍历注册组件 ========= */
|
|
74
|
-
Object.values(components).forEach((comp: any) => {
|
|
75
|
-
if (comp && !comp.install) {
|
|
76
|
-
comp.install = (app: App) => {
|
|
77
|
-
app.component(comp.name, comp)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
/* ========= 遍历注册服务 ========= */
|
|
83
|
-
Object.values(services).forEach((srv: any, idx) => {
|
|
84
|
-
if (srv && !srv.install) {
|
|
85
|
-
const key = Object.keys(services)[idx]
|
|
86
|
-
srv.install = (app: App) => {
|
|
87
|
-
app.config.globalProperties[`$${key}`] = srv
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
/* ========= 全量 install ========= */
|
|
93
|
-
export const install: Plugin['install'] = (app: App) => {
|
|
94
|
-
Object.values(components).forEach((comp: any) => {
|
|
95
|
-
comp.install?.(app)
|
|
96
|
-
})
|
|
97
|
-
Object.values(services).forEach((srv: any) => {
|
|
98
|
-
srv.install?.(app)
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* ========= 按需导出 ========= */
|
|
103
|
-
export {
|
|
104
|
-
DpButton,
|
|
105
|
-
CheckBox,
|
|
106
|
-
CheckBoxGroup,
|
|
107
|
-
DpHeader,
|
|
108
|
-
Message,
|
|
109
|
-
Modal,
|
|
110
|
-
Prompt,
|
|
111
|
-
Picker,
|
|
112
|
-
RadioBox,
|
|
113
|
-
RadioBoxGroup,
|
|
114
|
-
Swipe,
|
|
115
|
-
Tab,
|
|
116
|
-
SlideBar,
|
|
117
|
-
TextBar,
|
|
118
|
-
Upload,
|
|
119
|
-
ActionSheet,
|
|
120
|
-
SwitchBar,
|
|
121
|
-
Rater,
|
|
122
|
-
Spinner,
|
|
123
|
-
DpLoadMore,
|
|
124
|
-
Popup,
|
|
125
|
-
Indicator,
|
|
126
|
-
Progress,
|
|
127
|
-
ToTop,
|
|
128
|
-
Cell,
|
|
129
|
-
CellSwipe,
|
|
130
|
-
Badge,
|
|
131
|
-
Card
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/* ========= 默认导出 ========= */
|
|
135
|
-
const Dpzvc3UI: Plugin = { install }
|
|
136
|
-
export default Dpzvc3UI
|