dpzvc-ui 1.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 +21 -0
- package/README.md +46 -0
- package/build-style.js +42 -0
- package/dist/dpzvc.js +17605 -0
- package/dist/styles/dpzvc.css +1 -0
- package/dist-prod/index.html +26 -0
- package/dist-prod/main.js +1 -0
- package/dist-prod/vendor.bundle.js +1 -0
- package/package.json +88 -0
- package/src/components/Indicator/Indicator.vue +77 -0
- package/src/components/Indicator/index.js +153 -0
- package/src/components/Text/Number.vue +201 -0
- package/src/components/Text/index.js +7 -0
- package/src/components/Text/textBar.vue +142 -0
- package/src/components/action-sheet/actionSheet.vue +91 -0
- package/src/components/action-sheet/index.js +5 -0
- package/src/components/app.vue +66 -0
- package/src/components/badge/badge.vue +77 -0
- package/src/components/badge/index.js +5 -0
- package/src/components/button/button.vue +122 -0
- package/src/components/button/index.js +5 -0
- package/src/components/card/card.vue +59 -0
- package/src/components/card/index.js +5 -0
- package/src/components/cell/cell.vue +103 -0
- package/src/components/cell/index.js +5 -0
- package/src/components/cell-swipe/cell-swipe.vue +148 -0
- package/src/components/cell-swipe/index.js +5 -0
- package/src/components/checkBox/checkbox-group.vue +76 -0
- package/src/components/checkBox/checkbox.vue +107 -0
- package/src/components/checkBox/index.js +8 -0
- package/src/components/header/header.vue +82 -0
- package/src/components/header/index.js +5 -0
- package/src/components/loadMore/index.js +5 -0
- package/src/components/loadMore/loadmore.vue +293 -0
- package/src/components/message/confirm.js +52 -0
- package/src/components/message/index.js +132 -0
- package/src/components/message/message.vue +135 -0
- package/src/components/message/messageGroup.vue +74 -0
- package/src/components/modal/confirm.js +161 -0
- package/src/components/modal/index.js +63 -0
- package/src/components/modal/modal.vue +144 -0
- package/src/components/picker/area-picker/area-picker.vue +223 -0
- package/src/components/picker/area-picker/props.js +17 -0
- package/src/components/picker/date-picker/date-picker.vue +291 -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 +107 -0
- package/src/components/picker/normal-picker/props.js +20 -0
- package/src/components/picker/picker-slot.vue +206 -0
- package/src/components/picker/picker.vue +111 -0
- package/src/components/popup/index.js +5 -0
- package/src/components/popup/popup.vue +117 -0
- package/src/components/progress/index.js +5 -0
- package/src/components/progress/progress.vue +77 -0
- package/src/components/prompt/confirm.js +174 -0
- package/src/components/prompt/index.js +50 -0
- package/src/components/prompt/prompt.vue +166 -0
- package/src/components/radioBox/index.js +8 -0
- package/src/components/radioBox/radiobox-group.vue +74 -0
- package/src/components/radioBox/radiobox.vue +117 -0
- package/src/components/rater/index.js +5 -0
- package/src/components/rater/rater.vue +164 -0
- package/src/components/slideBar/index.js +6 -0
- package/src/components/slideBar/slideBar.vue +269 -0
- package/src/components/spinner/behavior/blade.vue +22 -0
- package/src/components/spinner/behavior/double-bounce.vue +22 -0
- package/src/components/spinner/behavior/fading-circle.vue +37 -0
- package/src/components/spinner/behavior/snake.vue +32 -0
- package/src/components/spinner/behavior/triple-bounce.vue +41 -0
- package/src/components/spinner/index.js +5 -0
- package/src/components/spinner/props.js +25 -0
- package/src/components/spinner/spinner.vue +74 -0
- package/src/components/swipe/index.js +5 -0
- package/src/components/swipe/swipe.vue +399 -0
- package/src/components/switchbar/index.js +5 -0
- package/src/components/switchbar/switchbar.vue +83 -0
- package/src/components/tab/index.js +6 -0
- package/src/components/tab/tab.vue +95 -0
- package/src/components/toTop/index.js +5 -0
- package/src/components/toTop/topTop.vue +76 -0
- package/src/components/upload/index.js +5 -0
- package/src/components/upload/upload.vue +200 -0
- package/src/config/config.js +17 -0
- package/src/directives/clickoutside.js +32 -0
- package/src/directives/tranferDom.js +65 -0
- package/src/index.js +83 -0
- package/src/lib/MegaPixImage.js +253 -0
- package/src/lib/exif.js +808 -0
- package/src/main.js +76 -0
- package/src/mixin/emitter.js +41 -0
- package/src/mixin/input.js +41 -0
- package/src/router.js +229 -0
- package/src/styles/base/font.less +99 -0
- package/src/styles/base/reset.less +69 -0
- package/src/styles/base/variable.less +108 -0
- package/src/styles/components/actionSheet.less +43 -0
- package/src/styles/components/badge.less +79 -0
- package/src/styles/components/button.less +123 -0
- package/src/styles/components/card.less +31 -0
- package/src/styles/components/cell-swipe.less +20 -0
- package/src/styles/components/cell.less +71 -0
- package/src/styles/components/checkBox.less +111 -0
- package/src/styles/components/editor.less +3 -0
- package/src/styles/components/header.less +70 -0
- package/src/styles/components/indicator.less +37 -0
- package/src/styles/components/loadmore.less +48 -0
- package/src/styles/components/message.less +57 -0
- package/src/styles/components/modal.less +82 -0
- package/src/styles/components/number.less +58 -0
- package/src/styles/components/picker.less +150 -0
- package/src/styles/components/popup.less +46 -0
- package/src/styles/components/progress.less +50 -0
- package/src/styles/components/prompt.less +37 -0
- package/src/styles/components/radioBox.less +136 -0
- package/src/styles/components/slide-Bar.less +147 -0
- package/src/styles/components/spinner.less +328 -0
- package/src/styles/components/swipe.less +125 -0
- package/src/styles/components/switchBar.less +88 -0
- package/src/styles/components/tab.less +69 -0
- package/src/styles/components/text.less +80 -0
- package/src/styles/components/toTop.less +26 -0
- package/src/styles/components/upload.less +23 -0
- package/src/styles/index.less +38 -0
- package/src/styles/utils/1px.less +204 -0
- package/src/styles/utils/animation.less +131 -0
- package/src/styles/utils/nowrap.less +19 -0
- package/src/template/index.ejs +26 -0
- package/src/utils/util.js +203 -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 +33 -0
- package/src/views/Badge.vue +40 -0
- package/src/views/Button.vue +40 -0
- package/src/views/Card.vue +52 -0
- package/src/views/Cell.vue +21 -0
- package/src/views/CellSwipe.vue +85 -0
- package/src/views/CheckBox.vue +53 -0
- package/src/views/Header.vue +47 -0
- package/src/views/Indicator.vue +69 -0
- package/src/views/LoadMore.vue +54 -0
- package/src/views/Message.vue +42 -0
- package/src/views/Modal.vue +32 -0
- package/src/views/Picker.vue +50 -0
- package/src/views/Popup.vue +87 -0
- package/src/views/Progress.vue +32 -0
- package/src/views/Prompt.vue +31 -0
- package/src/views/RadioBox.vue +55 -0
- package/src/views/Rater.vue +39 -0
- package/src/views/SlideBar.vue +47 -0
- package/src/views/Spinner.vue +15 -0
- package/src/views/Swipe.vue +34 -0
- package/src/views/SwitchBar.vue +36 -0
- package/src/views/Tab.vue +41 -0
- package/src/views/Text.vue +64 -0
- package/src/views/ToTop.vue +17 -0
- package/src/views/Upload.vue +44 -0
- package/src/views/guide.vue +159 -0
- package/src/views/index.vue +435 -0
- package/webpack.base.config.js +74 -0
- package/webpack.dev.config.js +67 -0
- package/webpack.dist.dev.config.js +44 -0
- package/webpack.dist.prod.config.js +50 -0
- package/webpack.prod.config.js +72 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="classes" >
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<sup v-show="visible" :class="supClasses">{{count}}</sup>
|
|
5
|
+
</span>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
|
|
10
|
+
const prefixCls = 'dpzvc-badge';
|
|
11
|
+
export default {
|
|
12
|
+
name: 'Badge',
|
|
13
|
+
props: {
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'danger',
|
|
17
|
+
validator(val){
|
|
18
|
+
return ['normal','danger','warning','success'].indexOf(val) > -1
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
color: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '#ffffff'
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'normal',
|
|
28
|
+
validator(val){
|
|
29
|
+
return ['small','normal','large'].indexOf(val) > -1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
dot: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
max: {
|
|
37
|
+
type: [Number,String],
|
|
38
|
+
default: 99
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
number:[Number,String]
|
|
42
|
+
},
|
|
43
|
+
data(){
|
|
44
|
+
return {
|
|
45
|
+
visible:true,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
computed:{
|
|
51
|
+
classes(){
|
|
52
|
+
return [
|
|
53
|
+
`${prefixCls}`
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
supClasses(){
|
|
57
|
+
return [
|
|
58
|
+
`${prefixCls}-${this.type}`,
|
|
59
|
+
{
|
|
60
|
+
[`${prefixCls}-size-${this.size}`]:!this.dot,
|
|
61
|
+
[`${prefixCls}-dot`]:this.dot
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
count(){
|
|
67
|
+
if (!!this.number && !isNaN(Number(this.number)) && !this.dot) {
|
|
68
|
+
return Number(this.number) < Number(this.max) ? String(this.number) : String(this.max) + '+'
|
|
69
|
+
} else if(!this.dot){
|
|
70
|
+
this.visible = false;
|
|
71
|
+
return ''
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="wrapperStyles">
|
|
3
|
+
<button :style="styles" :class="buttonClass" :disabled="disabled" @click="emit">
|
|
4
|
+
<slot name="left"><span class="loading" v-show="loading"><Spinner type="blade" size="15" color="#ffffff"></Spinner></span></slot>
|
|
5
|
+
<slot><span>确定</span></slot>
|
|
6
|
+
<slot name="right"></slot>
|
|
7
|
+
</button>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import Spinner from '../spinner'
|
|
13
|
+
const prefixCls = 'dpzvc-button';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name:'VButton',
|
|
17
|
+
props: {
|
|
18
|
+
type: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'normal',
|
|
21
|
+
validator: (val) => {
|
|
22
|
+
return ['success', 'loading', 'normal','primary', 'warning', 'danger', 'text'].indexOf(val) > -1
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
styles: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => {
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
circle: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
inline:{
|
|
40
|
+
type:Boolean,
|
|
41
|
+
default:false
|
|
42
|
+
},
|
|
43
|
+
width:{
|
|
44
|
+
type:String,
|
|
45
|
+
default:'100%'
|
|
46
|
+
},
|
|
47
|
+
height:{
|
|
48
|
+
type:String,
|
|
49
|
+
default:'40px'
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
loading:{
|
|
53
|
+
type:Boolean,
|
|
54
|
+
default:false
|
|
55
|
+
},
|
|
56
|
+
radius:{
|
|
57
|
+
type:Boolean,
|
|
58
|
+
default:true
|
|
59
|
+
},
|
|
60
|
+
border:{
|
|
61
|
+
type:String,
|
|
62
|
+
default(){
|
|
63
|
+
return 'all'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
computed: {
|
|
71
|
+
classes(){
|
|
72
|
+
|
|
73
|
+
return [
|
|
74
|
+
`${prefixCls}`,
|
|
75
|
+
{
|
|
76
|
+
[`${prefixCls}-circle`]: this.circle,
|
|
77
|
+
[`${prefixCls}-inline`]:this.inline
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
wrapperStyles(){
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
display:this.inline ? 'inline-block':'block',
|
|
85
|
+
width:this.width,
|
|
86
|
+
height:this.height
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
},
|
|
90
|
+
buttonClass(){
|
|
91
|
+
return [
|
|
92
|
+
`${prefixCls}-btn`,
|
|
93
|
+
[`dpzvc-1px-${this.border}`],
|
|
94
|
+
{
|
|
95
|
+
[`${prefixCls}-success`]: this.type == 'success',
|
|
96
|
+
[`${prefixCls}-loading`]: this.type == 'loading',
|
|
97
|
+
[`${prefixCls}-normal`]: this.type == 'normal',
|
|
98
|
+
[`${prefixCls}-warning`]: this.type == 'warning',
|
|
99
|
+
[`${prefixCls}-danger`]: this.type == 'danger',
|
|
100
|
+
[`${prefixCls}-text`]: this.type == 'text',
|
|
101
|
+
[`${prefixCls}-primary`]: this.type == 'primary',
|
|
102
|
+
[`${prefixCls}-disabled`]: this.disabled,
|
|
103
|
+
[`${prefixCls}-radius`]:this.radius,
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
components:{
|
|
112
|
+
Spinner
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
methods:{
|
|
116
|
+
emit(e){
|
|
117
|
+
if (this.disabled || this.loading) return;
|
|
118
|
+
this.$emit('click',e)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="{width:width}">
|
|
3
|
+
<div :class="headerClass">
|
|
4
|
+
<slot name="header"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div :class="contentClass">
|
|
7
|
+
<slot>
|
|
8
|
+
<div class="main"></div>
|
|
9
|
+
</slot>
|
|
10
|
+
</div>
|
|
11
|
+
<div :class="footerClass">
|
|
12
|
+
<slot name="footer"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
|
|
19
|
+
const prefixCls = 'dpzvc-card';
|
|
20
|
+
export default {
|
|
21
|
+
name:'Card',
|
|
22
|
+
props:{
|
|
23
|
+
width:{
|
|
24
|
+
type:String,
|
|
25
|
+
default:'100%'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
data(){
|
|
30
|
+
return {
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
computed:{
|
|
35
|
+
classes(){
|
|
36
|
+
return [
|
|
37
|
+
`${prefixCls}`
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
headerClass(){
|
|
41
|
+
return [
|
|
42
|
+
`${prefixCls}-header`,
|
|
43
|
+
'dpzvc-1px-bottom'
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
contentClass(){
|
|
47
|
+
return [
|
|
48
|
+
`${prefixCls}-content`
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
footerClass(){
|
|
52
|
+
return [
|
|
53
|
+
`${prefixCls}-footer`,
|
|
54
|
+
'dpzvc-1px-top'
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a :href="toLink" :class="classes">
|
|
3
|
+
<span v-if="hasMask" :class="maskClass"></span>
|
|
4
|
+
<div :class="leftClasses">
|
|
5
|
+
<slot name="left"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<div :class="wrapperClasses">
|
|
8
|
+
<div :class="titleClass">
|
|
9
|
+
<slot name="icon"></slot>
|
|
10
|
+
<slot name="title">
|
|
11
|
+
<span v-text="title"></span>
|
|
12
|
+
<span :class="labelClass" v-text="label"></span>
|
|
13
|
+
</slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div :class="valueClass">
|
|
16
|
+
<slot name="value">
|
|
17
|
+
<span v-text="value">说明文字</span>
|
|
18
|
+
</slot>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div :class="rightClasses">
|
|
22
|
+
<slot name="right"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</a>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
|
|
29
|
+
const prefixCls = 'dpzvc-cell';
|
|
30
|
+
export default {
|
|
31
|
+
name:'Cell',
|
|
32
|
+
props:{
|
|
33
|
+
title:String,
|
|
34
|
+
value:{},
|
|
35
|
+
label:String,
|
|
36
|
+
link:String,
|
|
37
|
+
hasMask:Boolean
|
|
38
|
+
},
|
|
39
|
+
computed:{
|
|
40
|
+
toLink(){
|
|
41
|
+
if (this.link && this.$router) {
|
|
42
|
+
|
|
43
|
+
let matchLink = this.$router.match(this.link)
|
|
44
|
+
if (!matchLink.matched.length) return this.link
|
|
45
|
+
|
|
46
|
+
this.$nextTick(()=>{
|
|
47
|
+
this.$el.addEventListener('click',this.handleClick,false)
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this.link
|
|
52
|
+
},
|
|
53
|
+
classes(){
|
|
54
|
+
return [
|
|
55
|
+
`${prefixCls}`
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
maskClass(){
|
|
59
|
+
return [
|
|
60
|
+
`${prefixCls}-mask`
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
leftClasses(){
|
|
64
|
+
return [
|
|
65
|
+
`${prefixCls}-left`
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
rightClasses(){
|
|
69
|
+
return [
|
|
70
|
+
`${prefixCls}-right`
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
wrapperClasses(){
|
|
74
|
+
return [
|
|
75
|
+
`${prefixCls}-main`,
|
|
76
|
+
'dpzvc-1px-top'
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
titleClass(){
|
|
80
|
+
return [
|
|
81
|
+
`${prefixCls}-main-title`,
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
valueClass(){
|
|
85
|
+
return [
|
|
86
|
+
`${prefixCls}-main-value`,
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
labelClass(){
|
|
90
|
+
return [
|
|
91
|
+
`${prefixCls}-main-label`,
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
methods:{
|
|
96
|
+
handleClick(e){
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
this.$router.push(this.link)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Cell
|
|
3
|
+
:title="title"
|
|
4
|
+
:value="value"
|
|
5
|
+
:label="label"
|
|
6
|
+
:link="link"
|
|
7
|
+
:has-mask="hasMask"
|
|
8
|
+
@click.native="swipe()"
|
|
9
|
+
v-clickoutside:touchstart="swipe"
|
|
10
|
+
@touchstart.native="onTouchStart"
|
|
11
|
+
@touchmove.native="onTouchMove"
|
|
12
|
+
@touchend.native="onTouchEnd"
|
|
13
|
+
ref="cell"
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
<div class="dpzvc-cell-swipe-group" slot="left" ref="left">
|
|
17
|
+
<span class="dpzvc-cell-swipe-btn"
|
|
18
|
+
v-for="item in left"
|
|
19
|
+
v-html="item.content"
|
|
20
|
+
:style="item.style"
|
|
21
|
+
@click.stop="item.handleClick && item.handleClick(),swipe()"></span>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<div class="dpzvc-cell-swipe-group" slot="right" ref="right">
|
|
26
|
+
<span class="dpzvc-cell-swipe-btn"
|
|
27
|
+
v-for="item in right"
|
|
28
|
+
v-html="item.content"
|
|
29
|
+
:style="item.style"
|
|
30
|
+
@click.stop="item.handleClick && item.handleClick(),swipe()"></span>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
</Cell>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
|
|
38
|
+
import Cell from '../cell'
|
|
39
|
+
import Clickoutside from '../../directives/clickoutside'
|
|
40
|
+
export default {
|
|
41
|
+
name: 'CellSwipe',
|
|
42
|
+
components: {
|
|
43
|
+
Cell
|
|
44
|
+
},
|
|
45
|
+
props: {
|
|
46
|
+
title: String,
|
|
47
|
+
value: {},
|
|
48
|
+
label: String,
|
|
49
|
+
link: String,
|
|
50
|
+
left: Array,
|
|
51
|
+
right: Array,
|
|
52
|
+
hasMask: Boolean
|
|
53
|
+
},
|
|
54
|
+
data(){
|
|
55
|
+
return {
|
|
56
|
+
isDrag: false,
|
|
57
|
+
translate: 0,
|
|
58
|
+
$wrapper: null,
|
|
59
|
+
$left: null,
|
|
60
|
+
$right: null,
|
|
61
|
+
leftWidth: 0,
|
|
62
|
+
rightWidth: 0,
|
|
63
|
+
startX: 0,
|
|
64
|
+
currentX: 0,
|
|
65
|
+
direction: '',
|
|
66
|
+
distance: 0
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
directives: {
|
|
70
|
+
Clickoutside
|
|
71
|
+
},
|
|
72
|
+
mounted(){
|
|
73
|
+
this.$wrapper = this.$refs.cell.$el.querySelector('.dpzvc-cell-main');
|
|
74
|
+
this.$left = this.$refs.left.parentNode
|
|
75
|
+
|
|
76
|
+
this.$right = this.$refs.right.parentNode
|
|
77
|
+
this.leftWidth = this.$left.offsetWidth
|
|
78
|
+
this.rightWidth = this.$right.offsetWidth
|
|
79
|
+
this.$left.style.webkitTransform = this.translate3d(-this.leftWidth)
|
|
80
|
+
this.$right.style.webkitTransform = this.translate3d(this.rightWidth + 1)
|
|
81
|
+
this.$wrapper.style.webkitTransform = this.translate3d(0)
|
|
82
|
+
|
|
83
|
+
},
|
|
84
|
+
computed: {},
|
|
85
|
+
methods: {
|
|
86
|
+
translate3d(translate){
|
|
87
|
+
return `translate3d(${translate}px,0,0)`
|
|
88
|
+
},
|
|
89
|
+
swipe(translate = 0){
|
|
90
|
+
|
|
91
|
+
this.translate = translate;
|
|
92
|
+
this.$wrapper.style.webkitTransform = this.translate3d(translate);
|
|
93
|
+
this.$left.style.webkitTransform = this.translate3d(-this.leftWidth + translate)
|
|
94
|
+
this.$right.style.webkitTransform = this.translate3d(this.rightWidth + translate)
|
|
95
|
+
},
|
|
96
|
+
onTouchStart(e){
|
|
97
|
+
|
|
98
|
+
this.startX = e.touches[0].clientX
|
|
99
|
+
},
|
|
100
|
+
onTouchMove(e){
|
|
101
|
+
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
this.currentX = e.touches[0].clientX
|
|
104
|
+
this.translate = this.currentX - this.startX
|
|
105
|
+
this.direction = this.translate < 0 ? 'left' : 'right'
|
|
106
|
+
|
|
107
|
+
this.translate = this.direction === 'left' ?
|
|
108
|
+
Math.abs(this.translate) > this.rightWidth ?
|
|
109
|
+
-this.rightWidth : this.translate :
|
|
110
|
+
Math.abs(this.translate) > this.leftWidth ?
|
|
111
|
+
this.leftWidth : this.translate
|
|
112
|
+
|
|
113
|
+
this.$nextTick(() => {
|
|
114
|
+
this.swipe(this.translate)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
onTouchEnd(){
|
|
120
|
+
|
|
121
|
+
if (Math.abs(this.translate) > this.leftWidth / 2 && this.direction === 'right') {
|
|
122
|
+
this.swipe(this.leftWidth)
|
|
123
|
+
} else if (Math.abs(this.translate < this.rightWidth && this.direction === 'left')) {
|
|
124
|
+
this.swipe(-this.rightWidth)
|
|
125
|
+
} else {
|
|
126
|
+
this.swipe()
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
},
|
|
131
|
+
watch: {
|
|
132
|
+
|
|
133
|
+
left(val){
|
|
134
|
+
this.$nextTick(() => {
|
|
135
|
+
this.leftWidth = this.$left.offsetWidth
|
|
136
|
+
this.swipe()
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
right(val){
|
|
140
|
+
this.$nextTick(() => {
|
|
141
|
+
|
|
142
|
+
this.rightWidth = this.$right.offsetWidth
|
|
143
|
+
this.swipe()
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['dpzvc-checkBoxGroup',vertical?'dpzvc-checkBoxGroup-vertical':'']" >
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
import {findComponentsDownward} from '../../utils/util'
|
|
10
|
+
import Emitter from '../../mixin/emitter'
|
|
11
|
+
export default {
|
|
12
|
+
name:'checkBoxGroup',
|
|
13
|
+
mixins:[Emitter],
|
|
14
|
+
props:{
|
|
15
|
+
value:{
|
|
16
|
+
type:Array,
|
|
17
|
+
default:()=>[]
|
|
18
|
+
},
|
|
19
|
+
single:{
|
|
20
|
+
type:Boolean,
|
|
21
|
+
default:false
|
|
22
|
+
},
|
|
23
|
+
vertical:{
|
|
24
|
+
type:Boolean,
|
|
25
|
+
default:false
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
},
|
|
29
|
+
data(){
|
|
30
|
+
return {
|
|
31
|
+
currentValue:this.value,
|
|
32
|
+
childrens:[]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods:{
|
|
36
|
+
change(data){
|
|
37
|
+
console.log(data)
|
|
38
|
+
this.currentValue = data;
|
|
39
|
+
this.$emit('input', data);
|
|
40
|
+
this.$emit('on-change',data);
|
|
41
|
+
this.dispatch('on-form-change',data)
|
|
42
|
+
},
|
|
43
|
+
updateModel(){
|
|
44
|
+
let model = this.value;
|
|
45
|
+
this.childrens = findComponentsDownward(this,'checkBox');
|
|
46
|
+
if(this.childrens) {
|
|
47
|
+
this.childrens.forEach((child)=>{
|
|
48
|
+
|
|
49
|
+
child.model = model;
|
|
50
|
+
child.currentValue = model.indexOf(child.label) >= 0;
|
|
51
|
+
child.isGroup = true;
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
mounted(){
|
|
58
|
+
|
|
59
|
+
this.updateModel()
|
|
60
|
+
},
|
|
61
|
+
watch:{
|
|
62
|
+
value(){
|
|
63
|
+
this.updateModel()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<style scoped>
|
|
71
|
+
.dpzvc-checkBoxGroup-vertical {
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
}
|
|
76
|
+
</style>
|