dpzvc3-ui 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +175 -0
- package/build-style.js +58 -0
- package/dist/dpzvc3.esm.js +17676 -0
- package/dist/dpzvc3.esm.js.map +1 -0
- package/dist/dpzvc3.esm.min.js +2 -0
- package/dist/dpzvc3.esm.min.js.map +1 -0
- package/dist/dpzvc3.js +15200 -0
- package/dist/dpzvc3.js.map +1 -0
- package/dist/dpzvc3.min.js +2 -0
- package/dist/dpzvc3.min.js.map +1 -0
- package/dist/styles/base/font.css +1 -0
- package/dist/styles/base/reset.css +1 -0
- package/dist/styles/base/variable.css +0 -0
- package/dist/styles/components/actionSheet.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/cell-swipe.css +1 -0
- package/dist/styles/components/cell.css +1 -0
- package/dist/styles/components/checkBox.css +1 -0
- package/dist/styles/components/editor.css +1 -0
- package/dist/styles/components/header.css +1 -0
- package/dist/styles/components/indicator.css +1 -0
- package/dist/styles/components/loadmore.css +1 -0
- package/dist/styles/components/message.css +1 -0
- package/dist/styles/components/modal.css +1 -0
- package/dist/styles/components/number.css +1 -0
- package/dist/styles/components/picker.css +1 -0
- package/dist/styles/components/popup.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/prompt.css +1 -0
- package/dist/styles/components/radioBox.css +1 -0
- package/dist/styles/components/slide-Bar.css +1 -0
- package/dist/styles/components/spinner.css +1 -0
- package/dist/styles/components/swipe.css +1 -0
- package/dist/styles/components/switchBar.css +1 -0
- package/dist/styles/components/tab.css +1 -0
- package/dist/styles/components/text.css +1 -0
- package/dist/styles/components/toTop.css +1 -0
- package/dist/styles/components/upload.css +1 -0
- package/dist/styles/dpzvc3.css +1 -0
- package/dist/styles/utils/1px.css +1 -0
- package/dist/styles/utils/animation.css +1 -0
- package/dist/styles/utils/nowrap.css +1 -0
- package/dist-prod/91.9d79b442ec3131707419.js +3 -0
- package/dist-prod/91.9d79b442ec3131707419.js.LICENSE.txt +25 -0
- package/dist-prod/91.9d79b442ec3131707419.js.map +1 -0
- package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js +2 -0
- package/dist-prod/actionsheet.e2f7c32d0120f5147a4f.chunk.js.map +1 -0
- package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js +2 -0
- package/dist-prod/badge.6038c4ccc54ffb56a645.chunk.js.map +1 -0
- package/dist-prod/button.28b491339fbba29c3f16.chunk.js +2 -0
- package/dist-prod/button.28b491339fbba29c3f16.chunk.js.map +1 -0
- package/dist-prod/card.3ad847f07bebc1391125.chunk.js +2 -0
- package/dist-prod/card.3ad847f07bebc1391125.chunk.js.map +1 -0
- package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js +2 -0
- package/dist-prod/cell.8920796a9ebd2d84bbd3.chunk.js.map +1 -0
- package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js +2 -0
- package/dist-prod/cellswipe.53b0178e4638c201dcf1.chunk.js.map +1 -0
- package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js +2 -0
- package/dist-prod/checkbox.87403976981ee0f64f4a.chunk.js.map +1 -0
- package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js +2 -0
- package/dist-prod/guide.5195c74796a7a0e37f7b.chunk.js.map +1 -0
- package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js +2 -0
- package/dist-prod/header.e3cecc6d60f801c1c105.chunk.js.map +1 -0
- package/dist-prod/index.html +19 -0
- package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js +2 -0
- package/dist-prod/indicator.6b0c7a91ca254c3586e8.chunk.js.map +1 -0
- package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js +2 -0
- package/dist-prod/loadmore.ba86c35311fc68ee215b.chunk.js.map +1 -0
- package/dist-prod/main.2e9aaa9095e329ea2d7b.js +2 -0
- package/dist-prod/main.2e9aaa9095e329ea2d7b.js.map +1 -0
- package/dist-prod/message.e57fa263a214006f7191.chunk.js +2 -0
- package/dist-prod/message.e57fa263a214006f7191.chunk.js.map +1 -0
- package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js +2 -0
- package/dist-prod/modal.1172c8ba7d90503fc8e8.chunk.js.map +1 -0
- package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js +2 -0
- package/dist-prod/picker.4ff114161c5c3f8df57a.chunk.js.map +1 -0
- package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js +2 -0
- package/dist-prod/popup.8f92c027932e4d47fa59.chunk.js.map +1 -0
- package/dist-prod/progress.1e0d785044aecadc5615.chunk.js +2 -0
- package/dist-prod/progress.1e0d785044aecadc5615.chunk.js.map +1 -0
- package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js +2 -0
- package/dist-prod/prompt.c2b442c3dd0e6d8319bc.chunk.js.map +1 -0
- package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js +2 -0
- package/dist-prod/radiobox.479703c69b75d473e85d.chunk.js.map +1 -0
- package/dist-prod/rater.939e0e7e770728f684c3.chunk.js +2 -0
- package/dist-prod/rater.939e0e7e770728f684c3.chunk.js.map +1 -0
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js +2 -0
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js.map +1 -0
- package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js +2 -0
- package/dist-prod/spinner.f20e3bd8cec27d26afe0.chunk.js.map +1 -0
- package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js +2 -0
- package/dist-prod/swipe.2e5b0acc3bbb2bf49dd5.chunk.js.map +1 -0
- package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js +2 -0
- package/dist-prod/switchbar.56d03d96c275ff4c65a1.chunk.js.map +1 -0
- package/dist-prod/tab.4c391211c41b7d12b585.chunk.js +2 -0
- package/dist-prod/tab.4c391211c41b7d12b585.chunk.js.map +1 -0
- package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js +2 -0
- package/dist-prod/text.ee2804ba87e6a460aa7d.chunk.js.map +1 -0
- package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js +2 -0
- package/dist-prod/totop.c6f9dce152bb6abe5cb2.chunk.js.map +1 -0
- package/dist-prod/upload.ec7a954970889869d93e.chunk.js +2 -0
- package/dist-prod/upload.ec7a954970889869d93e.chunk.js.map +1 -0
- package/images/IMG_2614 2 2.JPG +0 -0
- package/images/IMG_2614.JPG +0 -0
- package/images/IMG_2615 2.JPG +0 -0
- package/images/IMG_2615.JPG +0 -0
- package/package.json +113 -0
- package/postcss.config.js +5 -0
- package/src/components/Indicator/Indicator.vue +82 -0
- package/src/components/Indicator/index.js +86 -0
- package/src/components/Text/Number.vue +167 -0
- package/src/components/Text/index.js +7 -0
- package/src/components/Text/textBar.vue +122 -0
- package/src/components/action-sheet/actionSheet.vue +93 -0
- package/src/components/action-sheet/index.js +5 -0
- package/src/components/app.vue +61 -0
- package/src/components/badge/badge.vue +80 -0
- package/src/components/badge/index.js +5 -0
- package/src/components/button/button.vue +111 -0
- package/src/components/button/index.js +5 -0
- package/src/components/card/card.vue +49 -0
- package/src/components/card/index.js +5 -0
- package/src/components/cell/cell.vue +93 -0
- package/src/components/cell/index.js +5 -0
- package/src/components/cell-swipe/cell-swipe.vue +169 -0
- package/src/components/cell-swipe/index.js +5 -0
- package/src/components/checkBox/checkbox-group.vue +74 -0
- package/src/components/checkBox/checkbox.vue +117 -0
- package/src/components/checkBox/index.js +8 -0
- package/src/components/header/header.vue +130 -0
- package/src/components/header/index.js +5 -0
- package/src/components/loadMore/index.js +5 -0
- package/src/components/loadMore/loadmore.vue +258 -0
- package/src/components/message/confirm.js +60 -0
- package/src/components/message/index.js +111 -0
- package/src/components/message/message.vue +137 -0
- package/src/components/message/messageGroup.vue +82 -0
- package/src/components/modal/confirm.js +122 -0
- package/src/components/modal/index.js +52 -0
- package/src/components/modal/modal.vue +138 -0
- package/src/components/picker/area-picker/area-picker.vue +230 -0
- package/src/components/picker/area-picker/props.js +17 -0
- package/src/components/picker/date-picker/date-picker.vue +191 -0
- package/src/components/picker/date-picker/props.js +24 -0
- package/src/components/picker/index.js +5 -0
- package/src/components/picker/normal-picker/normal-picker.vue +120 -0
- package/src/components/picker/normal-picker/props.js +20 -0
- package/src/components/picker/picker-slot.vue +217 -0
- package/src/components/picker/picker.vue +111 -0
- package/src/components/popup/index.js +5 -0
- package/src/components/popup/popup.vue +91 -0
- package/src/components/progress/index.js +5 -0
- package/src/components/progress/progress.vue +86 -0
- package/src/components/prompt/confirm.js +91 -0
- package/src/components/prompt/index.js +53 -0
- package/src/components/prompt/prompt.vue +125 -0
- package/src/components/radioBox/index.js +8 -0
- package/src/components/radioBox/radiobox-group.vue +66 -0
- package/src/components/radioBox/radiobox.vue +88 -0
- package/src/components/rater/index.js +5 -0
- package/src/components/rater/rater.vue +118 -0
- package/src/components/slideBar/index.js +6 -0
- package/src/components/slideBar/slideBar.vue +207 -0
- package/src/components/spinner/behavior/blade.vue +42 -0
- package/src/components/spinner/behavior/double-bounce.vue +38 -0
- package/src/components/spinner/behavior/fading-circle.vue +55 -0
- package/src/components/spinner/behavior/snake.vue +41 -0
- package/src/components/spinner/behavior/triple-bounce.vue +52 -0
- package/src/components/spinner/index.js +5 -0
- package/src/components/spinner/props.js +28 -0
- package/src/components/spinner/spinner.vue +78 -0
- package/src/components/swipe/index.js +5 -0
- package/src/components/swipe/swipe.vue +281 -0
- package/src/components/switchbar/index.js +5 -0
- package/src/components/switchbar/switchbar.vue +79 -0
- package/src/components/tab/index.js +6 -0
- package/src/components/tab/tab.vue +89 -0
- package/src/components/toTop/index.js +5 -0
- package/src/components/toTop/topTop.vue +78 -0
- package/src/components/upload/index.js +5 -0
- package/src/components/upload/upload.vue +166 -0
- package/src/config/config.js +16 -0
- package/src/directives/clickoutside.js +42 -0
- package/src/directives/tranferDom.js +66 -0
- package/src/index.js +149 -0
- package/src/lib/MegaPixImage.js +163 -0
- package/src/lib/MegaPixImageOld.js +153 -0
- package/src/lib/exif-js.js +235 -0
- package/src/lib/exif.js +789 -0
- package/src/main.js +31 -0
- package/src/mixin/emitter.js +72 -0
- package/src/mixin/input.js +41 -0
- package/src/router.js +36 -0
- package/src/styles/base/font.less +99 -0
- package/src/styles/base/reset.less +135 -0
- package/src/styles/base/variable.less +108 -0
- package/src/styles/components/actionSheet.less +43 -0
- package/src/styles/components/badge.less +81 -0
- package/src/styles/components/button.less +124 -0
- package/src/styles/components/card.less +31 -0
- package/src/styles/components/cell-swipe.less +20 -0
- package/src/styles/components/cell.less +75 -0
- package/src/styles/components/checkBox.less +113 -0
- package/src/styles/components/editor.less +3 -0
- package/src/styles/components/header.less +72 -0
- package/src/styles/components/indicator.less +39 -0
- package/src/styles/components/loadmore.less +48 -0
- package/src/styles/components/message.less +57 -0
- package/src/styles/components/modal.less +84 -0
- package/src/styles/components/number.less +60 -0
- package/src/styles/components/picker.less +152 -0
- package/src/styles/components/popup.less +46 -0
- package/src/styles/components/progress.less +52 -0
- package/src/styles/components/prompt.less +37 -0
- package/src/styles/components/radioBox.less +138 -0
- package/src/styles/components/slide-Bar.less +149 -0
- package/src/styles/components/spinner.less +329 -0
- package/src/styles/components/swipe.less +125 -0
- package/src/styles/components/switchBar.less +88 -0
- package/src/styles/components/tab.less +71 -0
- package/src/styles/components/text.less +82 -0
- package/src/styles/components/toTop.less +28 -0
- package/src/styles/components/upload.less +23 -0
- package/src/styles/index.less +38 -0
- package/src/styles/utils/1px.less +206 -0
- package/src/styles/utils/animation.less +165 -0
- package/src/styles/utils/nowrap.less +19 -0
- package/src/template/index.ejs +40 -0
- package/src/utils/util.js +202 -0
- package/src/vconsole-resources.min.js +6 -0
- package/src/vconsole-sources.min.js +6 -0
- package/src/vconsole.min.js +7 -0
- package/src/views/ActionSheet.vue +46 -0
- package/src/views/Badge.vue +51 -0
- package/src/views/Button.vue +69 -0
- package/src/views/Card.vue +88 -0
- package/src/views/Cell.vue +30 -0
- package/src/views/CellSwipe.vue +68 -0
- package/src/views/CheckBox.vue +77 -0
- package/src/views/Header.vue +70 -0
- package/src/views/Indicator.vue +82 -0
- package/src/views/LoadMore.vue +73 -0
- package/src/views/Message.vue +61 -0
- package/src/views/Modal.vue +69 -0
- package/src/views/Picker.vue +140 -0
- package/src/views/Popup.vue +97 -0
- package/src/views/Progress.vue +47 -0
- package/src/views/Prompt.vue +43 -0
- package/src/views/RadioBox.vue +68 -0
- package/src/views/Rater.vue +49 -0
- package/src/views/SlideBar.vue +55 -0
- package/src/views/Spinner.vue +15 -0
- package/src/views/Swipe.vue +59 -0
- package/src/views/SwitchBar.vue +47 -0
- package/src/views/Tab.vue +53 -0
- package/src/views/Text.vue +93 -0
- package/src/views/ToTop.vue +17 -0
- package/src/views/Upload.vue +61 -0
- package/src/views/guide.vue +164 -0
- package/src/views/index.vue +554 -0
- package/webpack.base.config.js +65 -0
- package/webpack.dev.config.js +42 -0
- package/webpack.dist.dev.config.js +75 -0
- package/webpack.dist.prod.config.js +89 -0
- package/webpack.prod.config.js +51 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="dpzvc3-spinner-double-bounce"
|
|
4
|
+
:style="spinnerStyle"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-for="i in 2"
|
|
8
|
+
:key="i"
|
|
9
|
+
class="bounce"
|
|
10
|
+
:class="'bounce-' + i"
|
|
11
|
+
:style="bounceStyle"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { computed, defineComponent } from 'vue'
|
|
18
|
+
import spinnerProps from '../props' // 复用 spinnerProps
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'Dpzvc3DoubleBounce',
|
|
22
|
+
props: spinnerProps.props,
|
|
23
|
+
setup (props) {
|
|
24
|
+
const { spinnerStyle } = spinnerProps.setup(props)
|
|
25
|
+
|
|
26
|
+
const bounceStyle = computed(() => {
|
|
27
|
+
return props.color
|
|
28
|
+
? { backgroundColor: props.color }
|
|
29
|
+
: {}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
spinnerStyle,
|
|
34
|
+
bounceStyle
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="dpzvc3-spinner-fading-circle"
|
|
4
|
+
:style="spinnerStyle"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-for="i in 12"
|
|
8
|
+
:key="i"
|
|
9
|
+
class="block"
|
|
10
|
+
:class="'block-' + i"
|
|
11
|
+
:style="blockStyle(i - 1)"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
class="circle"
|
|
15
|
+
:class="'circle-' + i"
|
|
16
|
+
:style="circleStyle(i - 1)"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { computed, defineComponent } from 'vue'
|
|
24
|
+
import spinnerProps from '../props'
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: 'Dpzvc3FadingCircle',
|
|
28
|
+
props: spinnerProps.props,
|
|
29
|
+
setup (props) {
|
|
30
|
+
// 使用复用的 spinnerStyle
|
|
31
|
+
const { spinnerStyle } = spinnerProps.setup(props)
|
|
32
|
+
|
|
33
|
+
// block 旋转样式
|
|
34
|
+
const blockStyle = (index) => {
|
|
35
|
+
return {
|
|
36
|
+
transform: `rotate(${30 * index}deg)`
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// circle 样式,包括颜色和动画延迟
|
|
41
|
+
const circleStyle = (index) => {
|
|
42
|
+
return {
|
|
43
|
+
backgroundColor: props.color || '#39f',
|
|
44
|
+
animationDelay: `${(1.2 / 12) * index - 1.2}s`
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
spinnerStyle,
|
|
50
|
+
blockStyle,
|
|
51
|
+
circleStyle
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="dpzvc3-spinner-snake"
|
|
4
|
+
:style="spinnerStyle"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { computed, defineComponent } from 'vue'
|
|
10
|
+
import spinnerProps from '../props'
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: 'Dpzvc3Snake',
|
|
14
|
+
props: spinnerProps.props,
|
|
15
|
+
setup (props) {
|
|
16
|
+
// 计算 spinner 样式
|
|
17
|
+
const spinnerStyle = computed(() => {
|
|
18
|
+
const style = {}
|
|
19
|
+
|
|
20
|
+
if (props.size) {
|
|
21
|
+
const borderSize = Math.ceil(props.size / 8)
|
|
22
|
+
style.height = props.size + 'px'
|
|
23
|
+
style.width = props.size + 'px'
|
|
24
|
+
style.borderWidth = borderSize + 'px'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (props.color) {
|
|
28
|
+
style.borderTopColor = props.color
|
|
29
|
+
style.borderLeftColor = props.color
|
|
30
|
+
style.borderBottomColor = props.color
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return style
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
spinnerStyle
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="dpzvc3-spinner-triple-bounce"
|
|
4
|
+
:style="spinnerStyle"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-for="(i,key) in 3"
|
|
8
|
+
:key="key"
|
|
9
|
+
class="bounce"
|
|
10
|
+
:class="'bounce-' + i"
|
|
11
|
+
:style="bounceStyle"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script type="text/ecmascript-6">
|
|
17
|
+
import props from '../props'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
mixins: [props],
|
|
21
|
+
computed: {
|
|
22
|
+
// eslint-disable-next-line vue/return-in-computed-property
|
|
23
|
+
unitSize () {
|
|
24
|
+
if (this.size) {
|
|
25
|
+
return Math.round(this.size / 6) * 2
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// eslint-disable-next-line vue/return-in-computed-property
|
|
29
|
+
spinnerStyle () {
|
|
30
|
+
if (this.size) {
|
|
31
|
+
return {
|
|
32
|
+
padding: (this.size - this.unitSize) / 2 + 'px 0'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
bounceStyle () {
|
|
37
|
+
const style = {}
|
|
38
|
+
|
|
39
|
+
if (this.size) {
|
|
40
|
+
style.width = this.unitSize + 'px'
|
|
41
|
+
style.height = this.unitSize + 'px'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (this.color) {
|
|
45
|
+
style.backgroundColor = this.color
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return style
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// spinnerProps.js
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
size: {
|
|
7
|
+
type: [Number, String]
|
|
8
|
+
},
|
|
9
|
+
color: {
|
|
10
|
+
type: String
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup (props) {
|
|
14
|
+
const spinnerStyle = computed(() => {
|
|
15
|
+
if (props.size) {
|
|
16
|
+
return {
|
|
17
|
+
height: typeof Number(props.size) === 'number' ? `${props.size}px` : props.size,
|
|
18
|
+
width: typeof Number(props.size) === 'number' ? `${props.size}px` : props.size
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return {}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
spinnerStyle
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="spinnerComponent"
|
|
4
|
+
:type="type"
|
|
5
|
+
:size="size"
|
|
6
|
+
:color="color"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import { defineComponent, computed } from 'vue'
|
|
12
|
+
import SpinnerBlade from './behavior/blade.vue'
|
|
13
|
+
import SpinnerSnake from './behavior/snake.vue'
|
|
14
|
+
import SpinnerDoubleBounce from './behavior/double-bounce.vue'
|
|
15
|
+
import SpinnerTripleBounce from './behavior/triple-bounce.vue'
|
|
16
|
+
import SpinnerFadingCircle from './behavior/fading-circle.vue'
|
|
17
|
+
|
|
18
|
+
const SPINNERS = [
|
|
19
|
+
'blade',
|
|
20
|
+
'snake',
|
|
21
|
+
'double-bounce',
|
|
22
|
+
'triple-bounce',
|
|
23
|
+
'fading-circle'
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
function parseSpinner (index) {
|
|
27
|
+
index = index || 0
|
|
28
|
+
|
|
29
|
+
if (/^\d+$/.test(index)) {
|
|
30
|
+
if (SPINNERS.length <= index) {
|
|
31
|
+
console.warn(`'${index}' spinner not found, use the default spinner.`)
|
|
32
|
+
index = 0
|
|
33
|
+
}
|
|
34
|
+
return SPINNERS[index]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!SPINNERS.includes(index)) {
|
|
38
|
+
console.warn(`'${index}' spinner not found, use the default spinner.`)
|
|
39
|
+
index = SPINNERS[0]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return index
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default defineComponent({
|
|
46
|
+
name: 'Dpzvc3Spinner',
|
|
47
|
+
components: {
|
|
48
|
+
'spinner-blade': SpinnerBlade,
|
|
49
|
+
'spinner-snake': SpinnerSnake,
|
|
50
|
+
'spinner-double-bounce': SpinnerDoubleBounce,
|
|
51
|
+
'spinner-triple-bounce': SpinnerTripleBounce,
|
|
52
|
+
'spinner-fading-circle': SpinnerFadingCircle
|
|
53
|
+
},
|
|
54
|
+
props: {
|
|
55
|
+
size: {
|
|
56
|
+
type: [Number, String],
|
|
57
|
+
default: 30
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
type: [String, Number],
|
|
61
|
+
default: 'snake'
|
|
62
|
+
},
|
|
63
|
+
color: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '#39f'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setup (props) {
|
|
69
|
+
const spinnerComponent = computed(() => {
|
|
70
|
+
return `spinner-${parseSpinner(props.type)}`
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
spinnerComponent
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="swipeRef"
|
|
4
|
+
:class="classes"
|
|
5
|
+
:style="{ height }"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
ref="wrapper"
|
|
9
|
+
:class="wrapperClasses"
|
|
10
|
+
:style="wrapperStyle"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="arrayList.length">
|
|
13
|
+
<div
|
|
14
|
+
v-for="(item, index) in arrayList"
|
|
15
|
+
:key="index"
|
|
16
|
+
:class="itemClasses"
|
|
17
|
+
>
|
|
18
|
+
<template v-if="isMultiple">
|
|
19
|
+
<a
|
|
20
|
+
v-for="(_item, $index) in item"
|
|
21
|
+
:key="$index"
|
|
22
|
+
:class="multipleClass"
|
|
23
|
+
@click="choose(_item, $index, $event)"
|
|
24
|
+
>
|
|
25
|
+
<slot
|
|
26
|
+
:item="_item"
|
|
27
|
+
:index="$index"
|
|
28
|
+
>
|
|
29
|
+
<img :src="_item.image">
|
|
30
|
+
<span>{{ _item.spec }}</span>
|
|
31
|
+
</slot>
|
|
32
|
+
</a>
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else>
|
|
35
|
+
<a
|
|
36
|
+
:class="singleClass"
|
|
37
|
+
@click="choose(item, index, $event)"
|
|
38
|
+
>
|
|
39
|
+
<slot
|
|
40
|
+
:item="item"
|
|
41
|
+
:index="index"
|
|
42
|
+
>
|
|
43
|
+
<img :src="item.image">
|
|
44
|
+
<span>{{ item.spec }}</span>
|
|
45
|
+
</slot>
|
|
46
|
+
</a>
|
|
47
|
+
</template>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div :class="dotsClasses">
|
|
53
|
+
<span
|
|
54
|
+
v-for="(item, index) in dotLength"
|
|
55
|
+
:key="index"
|
|
56
|
+
:class="['dpzvc3-swipe-dots-item', (loop ? index + 1 : index) === slideIndex ? 'active' : '']"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
import { defineComponent, ref, computed, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
|
64
|
+
|
|
65
|
+
const prefixCls = 'dpzvc3-swipe'
|
|
66
|
+
|
|
67
|
+
export default defineComponent({
|
|
68
|
+
name: 'Dpzvc3Swipe',
|
|
69
|
+
props: {
|
|
70
|
+
auto: { type: Boolean, default: true },
|
|
71
|
+
list: { type: Array, default: () => [] },
|
|
72
|
+
startIndex: { type: Number, default: 0 },
|
|
73
|
+
height: { type: [Number, String], default: 'auto' },
|
|
74
|
+
dots: { type: String, default: 'bottom' },
|
|
75
|
+
multiple: { type: Boolean, default: false },
|
|
76
|
+
distanceIndex: { type: Number, default: 1.5 },
|
|
77
|
+
loop: { type: Boolean, default: true },
|
|
78
|
+
speed: { type: Number, default: 2 },
|
|
79
|
+
perpage: { type: Number, default: 1 }
|
|
80
|
+
},
|
|
81
|
+
setup (props) {
|
|
82
|
+
const wrapper = ref(null)
|
|
83
|
+
const swipeRef = ref(null)
|
|
84
|
+
const clientWidth = ref(0)
|
|
85
|
+
const translateX = ref(0)
|
|
86
|
+
const currentTranslateX = ref(0)
|
|
87
|
+
const dragging = ref(false)
|
|
88
|
+
const autoSwipe = ref(true)
|
|
89
|
+
const startX = ref(0)
|
|
90
|
+
const distance = ref(0)
|
|
91
|
+
const slideIndex = ref(props.loop ? props.startIndex + 1 : props.startIndex)
|
|
92
|
+
const timer = ref(null)
|
|
93
|
+
const localList = ref([...props.list])
|
|
94
|
+
|
|
95
|
+
const isMultiple = computed(() => {
|
|
96
|
+
if (props.perpage <= 1) return false
|
|
97
|
+
const page = props.perpage
|
|
98
|
+
const multipleArr = []
|
|
99
|
+
let arr = []
|
|
100
|
+
localList.value.forEach((item, idx) => {
|
|
101
|
+
arr.push(item)
|
|
102
|
+
if (arr.length === page || idx === localList.value.length - 1) {
|
|
103
|
+
multipleArr.push(arr)
|
|
104
|
+
arr = []
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
108
|
+
localList.value = multipleArr
|
|
109
|
+
return true
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const arrayList = computed(() => {
|
|
113
|
+
if (!localList.value.length) return []
|
|
114
|
+
if (props.loop) {
|
|
115
|
+
return [localList.value[localList.value.length - 1], ...localList.value, localList.value[0]]
|
|
116
|
+
}
|
|
117
|
+
return localList.value
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
const dotLength = computed(() => localList.value.length)
|
|
121
|
+
|
|
122
|
+
const minIndex = computed(() => (props.loop ? 1 : 0))
|
|
123
|
+
const maxIndex = computed(() => (props.loop ? arrayList.value.length - 2 : arrayList.value.length - 1))
|
|
124
|
+
|
|
125
|
+
const classes = computed(() => [prefixCls])
|
|
126
|
+
const wrapperClasses = computed(() => [prefixCls + '-wrapper', { [`${prefixCls}-dragging`]: dragging.value }])
|
|
127
|
+
const multipleClass = computed(() => prefixCls + '-multiple')
|
|
128
|
+
const singleClass = computed(() => prefixCls + '-single')
|
|
129
|
+
const itemClasses = computed(() => [prefixCls + '-item', { multiple: isMultiple.value }])
|
|
130
|
+
const dotsClasses = computed(() => [
|
|
131
|
+
prefixCls + '-dots',
|
|
132
|
+
{ [`${prefixCls}-dots-bottom`]: props.dots === 'bottom', [`${prefixCls}-dots-top`]: props.dots === 'top' }
|
|
133
|
+
])
|
|
134
|
+
const wrapperStyle = computed(() => ({
|
|
135
|
+
width: arrayList.value.length * clientWidth.value + 'px',
|
|
136
|
+
transform: `translate3d(${translateX.value}px,0,0)`,
|
|
137
|
+
height: 'auto'
|
|
138
|
+
}))
|
|
139
|
+
|
|
140
|
+
function choose (item, index, e) {
|
|
141
|
+
if (item.onClick && typeof item.onClick === 'function') {
|
|
142
|
+
item.onClick(item, index)
|
|
143
|
+
} else if (item.link) {
|
|
144
|
+
if (/https?:\/\//i.test(item.link)) {
|
|
145
|
+
window.location.href = item.link
|
|
146
|
+
} else if (e?.router) {
|
|
147
|
+
e.preventDefault()
|
|
148
|
+
e.router.push(item.link)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function onTouchStart (e) {
|
|
154
|
+
dragging.value = true
|
|
155
|
+
autoSwipe.value = false
|
|
156
|
+
startX.value = e.touches[0].clientX
|
|
157
|
+
currentTranslateX.value = translateX.value
|
|
158
|
+
distance.value = 0
|
|
159
|
+
clearTimer()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function onTouchMove (e) {
|
|
163
|
+
const currentX = e.touches[0].clientX
|
|
164
|
+
distance.value = props.distanceIndex ? (currentX - startX.value) / props.distanceIndex : currentX - startX.value
|
|
165
|
+
translateX.value = currentTranslateX.value + distance.value
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function onTouchEnd () {
|
|
169
|
+
if (distance.value < 0 && Math.abs(distance.value) > clientWidth.value / 5) {
|
|
170
|
+
props.loop && props.auto ? onLoopSlideLeft() : onSlideLeft()
|
|
171
|
+
} else if (distance.value > 0 && Math.abs(distance.value) > clientWidth.value / 5) {
|
|
172
|
+
props.loop && props.auto ? onLoopSlideRight() : onSlideRight()
|
|
173
|
+
} else {
|
|
174
|
+
translateX.value = currentTranslateX.value
|
|
175
|
+
}
|
|
176
|
+
dragging.value = false
|
|
177
|
+
autoSwipe.value = true
|
|
178
|
+
if (props.auto) autoSlide()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function onSlideLeft () {
|
|
182
|
+
if (slideIndex.value < maxIndex.value) slideIndex.value++
|
|
183
|
+
translateX.value = -slideIndex.value * clientWidth.value
|
|
184
|
+
}
|
|
185
|
+
function onSlideRight () {
|
|
186
|
+
if (slideIndex.value > minIndex.value) slideIndex.value--
|
|
187
|
+
translateX.value = -slideIndex.value * clientWidth.value
|
|
188
|
+
}
|
|
189
|
+
function onLoopSlideLeft () {
|
|
190
|
+
onSlideLeft()
|
|
191
|
+
if (slideIndex.value > maxIndex.value) {
|
|
192
|
+
slideIndex.value = maxIndex.value
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function onLoopSlideRight () {
|
|
196
|
+
onSlideRight()
|
|
197
|
+
if (slideIndex.value < minIndex.value) {
|
|
198
|
+
slideIndex.value = minIndex.value
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function autoSlide () {
|
|
203
|
+
timer.value = setTimeout(() => {
|
|
204
|
+
if (!dragging.value && autoSwipe.value) {
|
|
205
|
+
translateX.value -= clientWidth.value
|
|
206
|
+
slideIndex.value++
|
|
207
|
+
// console.log(slideIndex.value, maxIndex.value, 'dsdadddasdss')
|
|
208
|
+
if (slideIndex.value > maxIndex.value && props.loop) {
|
|
209
|
+
slideIndex.value = minIndex.value
|
|
210
|
+
wrapper.value.addEventListener('transitionend', resetSlide, false)
|
|
211
|
+
}
|
|
212
|
+
autoSlide()
|
|
213
|
+
}
|
|
214
|
+
}, props.speed < 1 ? 1000 : props.speed * 1000)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function resetSlide () {
|
|
218
|
+
wrapper.value.removeEventListener('transitionend', resetSlide, false)
|
|
219
|
+
|
|
220
|
+
slideIndex.value = minIndex.value
|
|
221
|
+
autoSwipe.value = false
|
|
222
|
+
// this.translateX = -this.slideIndex * this.clientWidth
|
|
223
|
+
translateX.value = -slideIndex.value * clientWidth.value
|
|
224
|
+
setTimeout(() => {
|
|
225
|
+
autoSwipe.value = true
|
|
226
|
+
}, 0)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function clearTimer () {
|
|
230
|
+
if (timer.value) clearTimeout(timer.value)
|
|
231
|
+
timer.value = null
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function onResize () {
|
|
235
|
+
if (wrapper.value) clientWidth.value = wrapper.value.clientWidth
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
onMounted(() => {
|
|
239
|
+
// nextTick(() => {
|
|
240
|
+
clientWidth.value = swipeRef.value ? swipeRef.value.clientWidth : 0
|
|
241
|
+
if (props.auto) autoSlide()
|
|
242
|
+
|
|
243
|
+
if (wrapper.value) {
|
|
244
|
+
wrapper.value.addEventListener('touchstart', onTouchStart)
|
|
245
|
+
wrapper.value.addEventListener('touchmove', onTouchMove)
|
|
246
|
+
wrapper.value.addEventListener('touchend', onTouchEnd)
|
|
247
|
+
}
|
|
248
|
+
window.addEventListener('resize', onResize)
|
|
249
|
+
// })
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
onBeforeUnmount(() => {
|
|
253
|
+
if (wrapper.value) {
|
|
254
|
+
wrapper.value.removeEventListener('touchstart', onTouchStart)
|
|
255
|
+
wrapper.value.removeEventListener('touchmove', onTouchMove)
|
|
256
|
+
wrapper.value.removeEventListener('touchend', onTouchEnd)
|
|
257
|
+
}
|
|
258
|
+
window.removeEventListener('resize', onResize)
|
|
259
|
+
clearTimer()
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
wrapper,
|
|
264
|
+
translateX,
|
|
265
|
+
slideIndex,
|
|
266
|
+
classes,
|
|
267
|
+
wrapperClasses,
|
|
268
|
+
multipleClass,
|
|
269
|
+
singleClass,
|
|
270
|
+
itemClasses,
|
|
271
|
+
dotsClasses,
|
|
272
|
+
arrayList,
|
|
273
|
+
isMultiple,
|
|
274
|
+
dotLength,
|
|
275
|
+
wrapperStyle,
|
|
276
|
+
choose,
|
|
277
|
+
swipeRef
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes">
|
|
3
|
+
<input
|
|
4
|
+
:id="name"
|
|
5
|
+
v-model="currentValue"
|
|
6
|
+
type="checkbox"
|
|
7
|
+
:class="inputCheckClasses"
|
|
8
|
+
>
|
|
9
|
+
<label
|
|
10
|
+
:for="name"
|
|
11
|
+
:class="sizeClasses"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { defineComponent, ref, computed, watch, onMounted } from 'vue'
|
|
18
|
+
import { randomStr } from '../../utils/util'
|
|
19
|
+
|
|
20
|
+
const prefixCls = 'dpzvc3-switch'
|
|
21
|
+
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
name: 'SwitchBar',
|
|
24
|
+
props: {
|
|
25
|
+
id: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
modelValue: { // Vue 3 使用 v-model 绑定 modelValue
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'small',
|
|
36
|
+
validator (val) {
|
|
37
|
+
return ['small', 'large'].includes(val)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ['update:modelValue'],
|
|
42
|
+
setup (props, { emit }) {
|
|
43
|
+
const name = ref(props.id || '')
|
|
44
|
+
const currentValue = ref(props.modelValue)
|
|
45
|
+
|
|
46
|
+
// 监听外部 v-model 变化
|
|
47
|
+
watch(() => props.modelValue, val => {
|
|
48
|
+
currentValue.value = val
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// 监听内部 value 变化,通知父组件
|
|
52
|
+
watch(currentValue, val => {
|
|
53
|
+
emit('update:modelValue', val)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// 组件挂载时,如果没有传 id,自动生成
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
if (!props.id) {
|
|
59
|
+
name.value = Date.now() + '_' + randomStr()
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const classes = computed(() => [prefixCls])
|
|
64
|
+
const inputCheckClasses = computed(() => [`${prefixCls}-checkbox`, 'hidden'])
|
|
65
|
+
const sizeClasses = computed(() => [
|
|
66
|
+
`${prefixCls}-ui`,
|
|
67
|
+
{ small: props.size === 'small' }
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
name,
|
|
72
|
+
currentValue,
|
|
73
|
+
classes,
|
|
74
|
+
inputCheckClasses,
|
|
75
|
+
sizeClasses
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
</script>
|