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,206 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="styles">
|
|
3
|
+
<ul :class="draggingClass" :style="{transform:`translate3d(0,${translateY}px,0)`}" @touchstart="_onTouchStart"
|
|
4
|
+
@touchmove="_onTouchMove" @touchend="_onTouchEnd">
|
|
5
|
+
|
|
6
|
+
<li :style="{height:height+'px'}"></li>
|
|
7
|
+
<li :style="{height:height+'px'}"></li>
|
|
8
|
+
<li v-for="(item,index) in list" :class="{'current':index == current.index,
|
|
9
|
+
'level_1_1':index - current.index == 1,
|
|
10
|
+
'level_2_1':index - current.index == 2,
|
|
11
|
+
'level_3_1':index - current.index >= 3,
|
|
12
|
+
'level_1':index - current.index == -1,
|
|
13
|
+
'level_2':index - current.index == -2,
|
|
14
|
+
'level_3':index - current.index <= -3}"
|
|
15
|
+
:style="{textAlign:align,height:height+'px'}">{{item.value}}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
</li>
|
|
20
|
+
<li :style="{height:height+'px'}"></li>
|
|
21
|
+
<li :style="{height:height+'px'}"></li>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import {findComponentUpward} from '../../utils/util'
|
|
28
|
+
const prefixCls = 'dpzvc-picker-slot';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
data(){
|
|
32
|
+
return {
|
|
33
|
+
count: 7, //默认显示行数
|
|
34
|
+
height: 35,
|
|
35
|
+
current: {},
|
|
36
|
+
translateY: 0,
|
|
37
|
+
currentTranslateY: 0,
|
|
38
|
+
dragging: false,
|
|
39
|
+
startX: 0,
|
|
40
|
+
startY: 0,
|
|
41
|
+
delta: {x: 0, y: 0},
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
watch: {
|
|
45
|
+
list(value){
|
|
46
|
+
|
|
47
|
+
if (value.length) {
|
|
48
|
+
let index = this.getSelectedIndex();
|
|
49
|
+
if (!value.length > index - 1) index = 0
|
|
50
|
+
console.warn(value[index])
|
|
51
|
+
this.current = Object.assign({}, this.current, value[index]);
|
|
52
|
+
this.$emit('change', this.target, this.current)
|
|
53
|
+
} else {
|
|
54
|
+
this.translateY = 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
},
|
|
58
|
+
initItem(value){
|
|
59
|
+
|
|
60
|
+
if (!value) {
|
|
61
|
+
this.current = Object.assign({}, this.current, {
|
|
62
|
+
code: '',
|
|
63
|
+
target: this.target,
|
|
64
|
+
index: '',
|
|
65
|
+
value: ''
|
|
66
|
+
});
|
|
67
|
+
this.$emit('change', this.target, this.current)
|
|
68
|
+
} else {
|
|
69
|
+
this.scrollToItem(value)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
mounted(){
|
|
77
|
+
if (!this.initItem && this.initItem !== 0) {
|
|
78
|
+
|
|
79
|
+
this.current = Object.assign({}, this.current, {code: '', target: this.target, index: '', value: ''});
|
|
80
|
+
this.$emit('change', this.target, this.current)
|
|
81
|
+
} else {
|
|
82
|
+
|
|
83
|
+
this.scrollToItem(this.initItem)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
},
|
|
88
|
+
props: {
|
|
89
|
+
styles: Object,
|
|
90
|
+
list: {
|
|
91
|
+
type: Array,
|
|
92
|
+
default: () => []
|
|
93
|
+
},
|
|
94
|
+
align: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'center'
|
|
97
|
+
},
|
|
98
|
+
target: {
|
|
99
|
+
type: String,
|
|
100
|
+
required: true
|
|
101
|
+
},
|
|
102
|
+
initItem: {
|
|
103
|
+
type: [String, Number],
|
|
104
|
+
default: ''
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
classes(){
|
|
109
|
+
return [
|
|
110
|
+
`${prefixCls}`
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
draggingClass(){
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
[`${prefixCls}-dragging`]: this.dragging
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
wrapperHeight: {
|
|
121
|
+
get(){
|
|
122
|
+
return this.count * this.height;
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
getStyles(){
|
|
126
|
+
let styles = this.styles;
|
|
127
|
+
|
|
128
|
+
if (styles.height) {
|
|
129
|
+
|
|
130
|
+
this.height = styles.height / this.count
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return Object.assign({}, styles, {height: this.wrapperHeight})
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
methods: {
|
|
137
|
+
_onTouchStart(e){
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
e.stopPropagation();
|
|
140
|
+
this.currentTranslateY = this.translateY;
|
|
141
|
+
this.startX = e.touches[0].pageX;
|
|
142
|
+
this.startY = e.touches[0].pageY;
|
|
143
|
+
this.dragging = true;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
_onTouchMove(e){
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
e.stopPropagation();
|
|
149
|
+
this.delta.x = e.touches[0].pageX - this.startX;
|
|
150
|
+
this.delta.y = e.touches[0].pageY - this.startY;
|
|
151
|
+
this.translateY = this.delta.y + this.currentTranslateY;
|
|
152
|
+
},
|
|
153
|
+
_onTouchEnd(e){
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
this.dragging = false;
|
|
157
|
+
this.currentTranslateY = this.translateY;
|
|
158
|
+
let index = this.getSelectedIndex();
|
|
159
|
+
this.setSelectedItem(index);
|
|
160
|
+
},
|
|
161
|
+
getSelectedIndex(){
|
|
162
|
+
let height = this.height;
|
|
163
|
+
let maxIndex = this.list.length - 1;
|
|
164
|
+
let index = -Math.round(this.currentTranslateY / height);
|
|
165
|
+
index = Math.max(index, 0);
|
|
166
|
+
index = Math.min(index, maxIndex);
|
|
167
|
+
return index;
|
|
168
|
+
},
|
|
169
|
+
setSelectedItem(index){
|
|
170
|
+
|
|
171
|
+
this.translateY = this.currentTranslateY = -index * this.height;
|
|
172
|
+
try {
|
|
173
|
+
if (this.current.code === this.list[index].code && this.current.value === this.list[index].value) {
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
this.current = Object.assign({}, this.current, {
|
|
177
|
+
code: this.list[index].code,
|
|
178
|
+
value: this.list[index].value,
|
|
179
|
+
target: this.target,
|
|
180
|
+
index: index
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
} catch (e) {
|
|
184
|
+
|
|
185
|
+
this.current = Object.assign({}, this.current, {
|
|
186
|
+
code: '',
|
|
187
|
+
value: '',
|
|
188
|
+
target: this.target,
|
|
189
|
+
index: ''
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
this.$emit('change', this.target, this.current);
|
|
193
|
+
|
|
194
|
+
},
|
|
195
|
+
scrollToItem (code){
|
|
196
|
+
this.list.forEach((item, i) => {
|
|
197
|
+
let currentCode = item.code;
|
|
198
|
+
if (currentCode == code) {
|
|
199
|
+
this.currentTranslateY = this.translateY;
|
|
200
|
+
this.setSelectedItem(i)
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Popup height="284px" position="bottom" v-model="visible">
|
|
3
|
+
<div :class="wrapperClass">
|
|
4
|
+
<div :class="contentClass">
|
|
5
|
+
<Area-picker v-if="type==='AreaPicker'"
|
|
6
|
+
:styles="styles"
|
|
7
|
+
:value-separator="valueSeparator"
|
|
8
|
+
:address-value="addressValue"
|
|
9
|
+
>
|
|
10
|
+
|
|
11
|
+
</Area-picker>
|
|
12
|
+
|
|
13
|
+
<Date-picker v-if="type==='DatePicker'"
|
|
14
|
+
:year="year" :month="month" :day="day"
|
|
15
|
+
:value-separator="valueSeparator"
|
|
16
|
+
:date-value="dateValue"
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
</Date-picker>
|
|
20
|
+
|
|
21
|
+
<Normal-picker v-if="type==='NormalPicker'"
|
|
22
|
+
:list="list"
|
|
23
|
+
:init-arr="initArr">
|
|
24
|
+
</Normal-picker>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</Popup>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
|
|
32
|
+
import areaProps from './area-picker/props'
|
|
33
|
+
import dateProps from './date-picker/props'
|
|
34
|
+
import normalProps from './normal-picker/props'
|
|
35
|
+
import Popup from '../popup'
|
|
36
|
+
import AreaPicker from './area-picker/area-picker.vue';
|
|
37
|
+
import DatePicker from './date-picker/date-picker.vue';
|
|
38
|
+
import NormalPicker from './normal-picker/normal-picker.vue';
|
|
39
|
+
const LIST = ['DatePicker', 'AreaPicker', 'NormalPicker'];
|
|
40
|
+
const prefixCls = 'dpzvc-picker';
|
|
41
|
+
export default {
|
|
42
|
+
name: 'Picker',
|
|
43
|
+
props: {
|
|
44
|
+
type: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'DatePicker',
|
|
47
|
+
validator(val){
|
|
48
|
+
return LIST.indexOf(val) > -1
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
value: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
mixins: [areaProps, dateProps, normalProps],
|
|
57
|
+
data(){
|
|
58
|
+
return {
|
|
59
|
+
visible: this.value,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
},
|
|
63
|
+
created(){
|
|
64
|
+
this.$on('ok', (val) => {
|
|
65
|
+
|
|
66
|
+
this.visible = false;
|
|
67
|
+
this.$emit('sure', val)
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
this.$on('fail', () => {
|
|
72
|
+
this.visible = false;
|
|
73
|
+
this.$emit('cancle')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
this.$on('scroll', (val) => {
|
|
77
|
+
this.$emit('normal-change',val)
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
mounted(){
|
|
81
|
+
// console.log(DatePicker)
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
components: {
|
|
85
|
+
AreaPicker,
|
|
86
|
+
DatePicker,
|
|
87
|
+
NormalPicker,
|
|
88
|
+
Popup
|
|
89
|
+
},
|
|
90
|
+
watch: {
|
|
91
|
+
value(val){
|
|
92
|
+
this.visible = val
|
|
93
|
+
},
|
|
94
|
+
visible(val){
|
|
95
|
+
this.$emit('input', val)
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
wrapperClass(){
|
|
100
|
+
return [
|
|
101
|
+
`${prefixCls}-wrapper`
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
contentClass(){
|
|
105
|
+
return [
|
|
106
|
+
`${prefixCls}-content`
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" >
|
|
3
|
+
<transition name="dpzvc-ani-fade">
|
|
4
|
+
<div class="dpzvc-popup-mask" v-show="visible" @click="close" v-if="mask" @touchmove.prevent ></div>
|
|
5
|
+
</transition>
|
|
6
|
+
<transition :name="'dpzvc-ani-'+position" >
|
|
7
|
+
<div v-show="visible" :class="popupClasses" :style="contentStyle">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</transition>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
|
|
16
|
+
const prefixCls = 'dpzvc-popup';
|
|
17
|
+
export default {
|
|
18
|
+
props:{
|
|
19
|
+
value:{
|
|
20
|
+
type:Boolean,
|
|
21
|
+
default:false
|
|
22
|
+
},
|
|
23
|
+
position:{
|
|
24
|
+
type:String,
|
|
25
|
+
default:'bottom'
|
|
26
|
+
},
|
|
27
|
+
showMask:{
|
|
28
|
+
type:Boolean,
|
|
29
|
+
default:true
|
|
30
|
+
},
|
|
31
|
+
maskClosable:{
|
|
32
|
+
type:Boolean,
|
|
33
|
+
default:true
|
|
34
|
+
},
|
|
35
|
+
width:{
|
|
36
|
+
type:[Number,String],
|
|
37
|
+
default:'100%'
|
|
38
|
+
},
|
|
39
|
+
height:{
|
|
40
|
+
type:[Number,String]
|
|
41
|
+
},
|
|
42
|
+
styles:{
|
|
43
|
+
type:Object,
|
|
44
|
+
default(){
|
|
45
|
+
return {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
computed:{
|
|
51
|
+
classes(){
|
|
52
|
+
return [
|
|
53
|
+
`${prefixCls}`
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
popupClasses(){
|
|
57
|
+
return [
|
|
58
|
+
`${prefixCls}-${this.position}`,
|
|
59
|
+
`${prefixCls}-content`
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
contentStyle(){
|
|
63
|
+
|
|
64
|
+
let height = '';
|
|
65
|
+
|
|
66
|
+
if (this.height != null) {
|
|
67
|
+
height = this.height
|
|
68
|
+
} else {
|
|
69
|
+
switch(this.position) {
|
|
70
|
+
case 'top':
|
|
71
|
+
height = 'auto';
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
height = '100%'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
return Object.assign({},this.styles,{
|
|
80
|
+
width:this.width,
|
|
81
|
+
height:height,
|
|
82
|
+
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
methods:{
|
|
87
|
+
close(){
|
|
88
|
+
if (this.maskClosable && this.showMask) this.visible = false
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
data(){
|
|
92
|
+
return {
|
|
93
|
+
visible:this.value,
|
|
94
|
+
mask:this.showMask
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
watch:{
|
|
98
|
+
value(val){
|
|
99
|
+
this.visible = val
|
|
100
|
+
},
|
|
101
|
+
visible(val){
|
|
102
|
+
this.$emit('input',val)
|
|
103
|
+
},
|
|
104
|
+
showMask(val){
|
|
105
|
+
this.mask = val
|
|
106
|
+
},
|
|
107
|
+
mask(val){
|
|
108
|
+
switch (this.position) {
|
|
109
|
+
case 'top':
|
|
110
|
+
return false;
|
|
111
|
+
default:
|
|
112
|
+
return val
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="styles">
|
|
3
|
+
<slot name="left"></slot>
|
|
4
|
+
<div :class="outerClass">
|
|
5
|
+
<div :class="runawayClass" :style="runawayStyle"></div>
|
|
6
|
+
<div :class="progressClass" :style="progressStyle"></div>
|
|
7
|
+
</div>
|
|
8
|
+
<slot name="right"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
|
|
14
|
+
const prefixCls = 'dpzvc-progress'
|
|
15
|
+
export default {
|
|
16
|
+
name:'progress',
|
|
17
|
+
|
|
18
|
+
props:{
|
|
19
|
+
styles:{
|
|
20
|
+
type:Object,
|
|
21
|
+
default(){
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
value:{
|
|
26
|
+
type:[Number,String],
|
|
27
|
+
default:'0',
|
|
28
|
+
},
|
|
29
|
+
barHeight:{
|
|
30
|
+
type:[String,Number],
|
|
31
|
+
default:'3'
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
},
|
|
35
|
+
data(){
|
|
36
|
+
return {
|
|
37
|
+
width:this.value
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
},
|
|
41
|
+
computed:{
|
|
42
|
+
classes(){
|
|
43
|
+
return [
|
|
44
|
+
`${prefixCls}`
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
outerClass(){
|
|
48
|
+
return [
|
|
49
|
+
`${prefixCls}-outer`
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
runawayClass(){
|
|
53
|
+
return [
|
|
54
|
+
`${prefixCls}-runaway`
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
progressClass(){
|
|
58
|
+
return [
|
|
59
|
+
`${prefixCls}-progress`
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
runawayStyle(){
|
|
63
|
+
return {height:this.barHeight+'px'}
|
|
64
|
+
},
|
|
65
|
+
progressStyle(){
|
|
66
|
+
return {height:this.barHeight+'px',width:this.width+'%'}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
watch:{
|
|
70
|
+
value(val){
|
|
71
|
+
this.width = val >= 100 ? 100 : val
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by admin on 2017/5/10.
|
|
3
|
+
*/
|
|
4
|
+
import Prompt from '../prompt/prompt.vue'
|
|
5
|
+
import Vue from 'vue'
|
|
6
|
+
|
|
7
|
+
import {camelcaseToHyphen} from '../../utils/util'
|
|
8
|
+
|
|
9
|
+
const prefixCls = 'v-lc-modal';
|
|
10
|
+
|
|
11
|
+
Prompt.newInstance = properties => {
|
|
12
|
+
|
|
13
|
+
let _props = properties || {};
|
|
14
|
+
|
|
15
|
+
let props = '';
|
|
16
|
+
|
|
17
|
+
Object.keys(_props).forEach(prop => {
|
|
18
|
+
|
|
19
|
+
props += ' :' + camelcaseToHyphen(prop) + '=' + prop
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const div = document.createElement('div');
|
|
24
|
+
|
|
25
|
+
document.body.appendChild(div);
|
|
26
|
+
|
|
27
|
+
const propmt = new Vue({
|
|
28
|
+
el: div,
|
|
29
|
+
|
|
30
|
+
template: `<Prompt ${props} v-model="visible"
|
|
31
|
+
:width="width"
|
|
32
|
+
:text="text"
|
|
33
|
+
:title="title"
|
|
34
|
+
:ok-text="okText"
|
|
35
|
+
:cancle-text="cancleText"
|
|
36
|
+
:loading="loading"
|
|
37
|
+
:spec="spec"
|
|
38
|
+
:message="message"
|
|
39
|
+
:validator="validator"
|
|
40
|
+
:on-ok="onOk"
|
|
41
|
+
:on-cancle="onCancle"> </Prompt>`,
|
|
42
|
+
components: {
|
|
43
|
+
Prompt
|
|
44
|
+
},
|
|
45
|
+
data: Object.assign(_props, {
|
|
46
|
+
text:'',
|
|
47
|
+
placeholderText: '请输入',
|
|
48
|
+
visible: false,
|
|
49
|
+
width: '70%',
|
|
50
|
+
title: '',
|
|
51
|
+
okText: '确定',
|
|
52
|
+
cancleText: '取消',
|
|
53
|
+
loading: false,
|
|
54
|
+
showCancle: true,
|
|
55
|
+
spec: '',
|
|
56
|
+
message: '',
|
|
57
|
+
validator: null,
|
|
58
|
+
onOk:function(){},
|
|
59
|
+
onCancle:function(prop){},
|
|
60
|
+
onRemove:function(){}
|
|
61
|
+
}),
|
|
62
|
+
methods: {
|
|
63
|
+
cancle(){
|
|
64
|
+
this.$children[0].visible = false;
|
|
65
|
+
this.onCancle();
|
|
66
|
+
this.remove();
|
|
67
|
+
},
|
|
68
|
+
ok(){
|
|
69
|
+
if (this.loading) {
|
|
70
|
+
this.buttonLoading = true;
|
|
71
|
+
} else {
|
|
72
|
+
this.visible = false;
|
|
73
|
+
this.remove();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.onOk()
|
|
77
|
+
},
|
|
78
|
+
remove(){
|
|
79
|
+
this.$children[0].visible = false;
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
this.destroy();
|
|
82
|
+
}, 300)
|
|
83
|
+
},
|
|
84
|
+
destroy(){
|
|
85
|
+
this.$destroy();
|
|
86
|
+
document.body.removeChild(this.$el);
|
|
87
|
+
this.onRemove()
|
|
88
|
+
},
|
|
89
|
+
mounted(){
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
}).$children[0]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
|
|
99
|
+
show(props){
|
|
100
|
+
|
|
101
|
+
propmt.$parent.showCancle = props.showCancle;
|
|
102
|
+
propmt.$parent.onRemove = props.onRemove;
|
|
103
|
+
propmt.visible = true;
|
|
104
|
+
|
|
105
|
+
if ('width' in props) {
|
|
106
|
+
propmt.$parent.width = props.width
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if ('text' in props) {
|
|
110
|
+
propmt.$parent.text = props.text
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if ('spec' in props) {
|
|
114
|
+
propmt.$parent.spec = props.spec
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if ('title' in props) {
|
|
118
|
+
|
|
119
|
+
propmt.$parent.title = props.title
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if ('placeholderText' in props) {
|
|
125
|
+
propmt.$parent.placeholderText = props.placeholderText
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if ('content' in props) {
|
|
129
|
+
propmt.$parent.body = props.body
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if ('okText' in props) {
|
|
134
|
+
propmt.$parent.okText = props.okText
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if ('cancleText' in props) {
|
|
138
|
+
propmt.$parent.cancleText = props.cancleText
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if ('onCancle' in props) {
|
|
142
|
+
propmt.$parent.onCancle = props.onCancle
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if ('onOk' in props) {
|
|
146
|
+
propmt.$parent.onOk = props.onOk
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if ('loading' in props) {
|
|
150
|
+
propmt.$parent.loading = props.loading
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if ('message' in props) {
|
|
154
|
+
propmt.$parent.message = props.message
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ('validator' in props) {
|
|
158
|
+
propmt.$parent.validator = props.validator
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
console.log(propmt.$parent)
|
|
162
|
+
},
|
|
163
|
+
remove () {
|
|
164
|
+
|
|
165
|
+
propmt.visible = false;
|
|
166
|
+
propmt.$parent.buttonLoading = false;
|
|
167
|
+
propmt.$parent.remove();
|
|
168
|
+
|
|
169
|
+
},
|
|
170
|
+
component: propmt
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export default Prompt;
|