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,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="getStyles">
|
|
3
|
+
<div :class="headerClasses" ref="header">
|
|
4
|
+
<div :class="wrapperClasses" ref="wrapper"
|
|
5
|
+
:style="{width:isFlex ? 'auto' : items.length * getItemWidth + 'px'}">
|
|
6
|
+
<div :class="['dpzvc-slideBar-child',startIndex == key ? 'active':'',!isFlex ? 'normalChild':'']"
|
|
7
|
+
v-for="(item,key) in items"
|
|
8
|
+
@click="changeBar(key,$event)"
|
|
9
|
+
:style="{textAlign:textAlign,width:getItemWidth+'px',height:scrollHeight,lineHeight:scrollHeight}">
|
|
10
|
+
<slot :name="'slide-bar-header-'+key">
|
|
11
|
+
<a class="content ellipse-fir">{{item.name}}</a>
|
|
12
|
+
</slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div :class="absoluteClass" :style="getScrollStyle"></div>
|
|
17
|
+
</div>
|
|
18
|
+
<div :class="containerClass" :style="{height:height}">
|
|
19
|
+
<div :class="contentClasses" :style="getContainerStyle" ref="content">
|
|
20
|
+
<div :class="['dpzvc-slideBar-content-item',startIndex == index ? 'active':'' ]"
|
|
21
|
+
v-for="(item,index) in items" :style="{width:clientWidth+'px'}">
|
|
22
|
+
<slot :name="'slot-item-'+index"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
const prefixCls = 'dpzvc-slideBar';
|
|
32
|
+
export default {
|
|
33
|
+
props: {
|
|
34
|
+
scrollHeight: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: '30px'
|
|
37
|
+
},
|
|
38
|
+
height: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
default: '100%'
|
|
41
|
+
},
|
|
42
|
+
styles: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => {
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
childWidth: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 70
|
|
50
|
+
},
|
|
51
|
+
scrollColor: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '#036eb8'
|
|
54
|
+
},
|
|
55
|
+
textAlign: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'center'
|
|
58
|
+
},
|
|
59
|
+
flex: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: true
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'normal'
|
|
66
|
+
},
|
|
67
|
+
onChange: {
|
|
68
|
+
type: Function,
|
|
69
|
+
},
|
|
70
|
+
list: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default: () => [{name: '1'}, {name: '2'}, {name: '3'}, {name: '4'}]
|
|
73
|
+
},
|
|
74
|
+
index: {
|
|
75
|
+
type: [Number, String],
|
|
76
|
+
default: 0,
|
|
77
|
+
},
|
|
78
|
+
distanceIndex: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 1.5
|
|
81
|
+
},
|
|
82
|
+
canDrag: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
// isFixedHeader: {
|
|
87
|
+
// type: Boolean,
|
|
88
|
+
// default: false
|
|
89
|
+
// }
|
|
90
|
+
},
|
|
91
|
+
mounted (){
|
|
92
|
+
this.clientWidth = this.$el.clientWidth;
|
|
93
|
+
this.translateX = -this.startIndex * this.clientWidth;
|
|
94
|
+
this.onScroll();
|
|
95
|
+
this.bindEvents();
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
getItemWidth(){
|
|
99
|
+
return this.isFlex ? this.clientWidth / this.items.length : this.childWidth;
|
|
100
|
+
},
|
|
101
|
+
classes(){
|
|
102
|
+
return [
|
|
103
|
+
`${prefixCls}`
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
headerClasses(){
|
|
107
|
+
return [
|
|
108
|
+
`${prefixCls}-header`,
|
|
109
|
+
{
|
|
110
|
+
['fixed']:this.fixed
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
wrapperClasses(){
|
|
115
|
+
return [
|
|
116
|
+
`${prefixCls}-wrapper`,
|
|
117
|
+
this.isFlex ? `${prefixCls}-flex` : `${prefixCls}-slide`,
|
|
118
|
+
{
|
|
119
|
+
['normal']: this.type == 'normal' && this.isFlex,
|
|
120
|
+
['vertical']: this.type == 'vertical' && this.isFlex
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
contentClasses(){
|
|
125
|
+
return [
|
|
126
|
+
`${prefixCls}-content`,
|
|
127
|
+
{
|
|
128
|
+
[`${prefixCls}-dragging`]: this.dragging
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
absoluteClass(){
|
|
133
|
+
return [
|
|
134
|
+
`${prefixCls}-wrapper-absolute`
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
containerClass(){
|
|
138
|
+
return [
|
|
139
|
+
`${prefixCls}-container`
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
getStyles(){
|
|
143
|
+
let style = {};
|
|
144
|
+
let customStyle = this.styles ? this.styles : {};
|
|
145
|
+
// let fixedStyle = {paddingTop: this.fixed ? this.scrollHeight : 0}
|
|
146
|
+
Object.assign(style, customStyle);
|
|
147
|
+
return style;
|
|
148
|
+
},
|
|
149
|
+
getContainerStyle(){
|
|
150
|
+
return {
|
|
151
|
+
width: `${this.clientWidth * this.items.length}px`,
|
|
152
|
+
transform: `translate3d(${this.translateX}px,0,0)`
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
getScrollStyle(){
|
|
156
|
+
return {
|
|
157
|
+
width: `${this.getItemWidth}px`,
|
|
158
|
+
transform: `translate3d(${this.startIndex * this.getItemWidth}px,0,0)`,
|
|
159
|
+
backgroundColor: this.scrollColor
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
wrapperWidth(){
|
|
163
|
+
return this.isFlex ? `auto` : `${this.getItemWidth * this.items.length}px`
|
|
164
|
+
},
|
|
165
|
+
maxIndex(){
|
|
166
|
+
return this.items.length - 1
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
data(){
|
|
170
|
+
return {
|
|
171
|
+
translateX: 0,
|
|
172
|
+
scrollWidth: 0,
|
|
173
|
+
clientWidth: 0,
|
|
174
|
+
startIndex: this.index,
|
|
175
|
+
startTranslateX: 0,
|
|
176
|
+
startX: 0,
|
|
177
|
+
currentX: 0,
|
|
178
|
+
dragging: false,
|
|
179
|
+
distance: 0,
|
|
180
|
+
items: this.list,
|
|
181
|
+
fixed: false,
|
|
182
|
+
isFlex: this.flex
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
methods: {
|
|
186
|
+
changeBar(index, event){
|
|
187
|
+
if (this.startIndex == index) return;
|
|
188
|
+
this.startIndex = index;
|
|
189
|
+
this.translateX = -this.startIndex * this.clientWidth;
|
|
190
|
+
this.$emit('on-change', index)
|
|
191
|
+
},
|
|
192
|
+
onTouchStart(e){
|
|
193
|
+
this.startTranslateX = this.translateX;
|
|
194
|
+
this.distance = 0;
|
|
195
|
+
this.startX = e.touches[0].clientX;
|
|
196
|
+
this.dragging = true;
|
|
197
|
+
},
|
|
198
|
+
onTouchMove(e){
|
|
199
|
+
this.currentX = e.touches[0].clientX;
|
|
200
|
+
if (this.distanceIndex) this.distance = (this.currentX - this.startX) / this.distanceIndex;
|
|
201
|
+
else this.distance = this.currentX - this.startX;
|
|
202
|
+
this.translateX = this.startTranslateX + this.distance
|
|
203
|
+
},
|
|
204
|
+
onTouchEnd(e){
|
|
205
|
+
if (this.distance < 0 && Math.abs(this.distance) > this.clientWidth / 2) {
|
|
206
|
+
this.onSlideLeft()
|
|
207
|
+
} else if (this.distance > 0 && Math.abs(this.distance) > this.clientWidth / 2) {
|
|
208
|
+
this.onSlideRight()
|
|
209
|
+
} else {
|
|
210
|
+
this.translateX = this.startTranslateX
|
|
211
|
+
}
|
|
212
|
+
this.dragging = false;
|
|
213
|
+
},
|
|
214
|
+
onSlideLeft(){
|
|
215
|
+
if (++this.startIndex > this.maxIndex) {
|
|
216
|
+
this.startIndex--;
|
|
217
|
+
this.translateX = this.startTranslateX
|
|
218
|
+
} else {
|
|
219
|
+
this.translateX = this.startTranslateX - this.clientWidth
|
|
220
|
+
}
|
|
221
|
+
this.$emit('on-change', this.startIndex)
|
|
222
|
+
},
|
|
223
|
+
onSlideRight(){
|
|
224
|
+
if (--this.startIndex < 0) {
|
|
225
|
+
this.startIndex++;
|
|
226
|
+
this.translateX = this.startTranslateX
|
|
227
|
+
} else {
|
|
228
|
+
this.translateX = this.startTranslateX + this.clientWidth
|
|
229
|
+
}
|
|
230
|
+
this.$emit('on-change', this.startIndex)
|
|
231
|
+
},
|
|
232
|
+
onScroll(e){
|
|
233
|
+
this.$el.getBoundingClientRect().top <= 0 ? this.fixed = true : this.fixed = false
|
|
234
|
+
},
|
|
235
|
+
onResize(){
|
|
236
|
+
this.clientWidth = this.$el.clientWidth;
|
|
237
|
+
},
|
|
238
|
+
bindEvents(){
|
|
239
|
+
if (this.canDrag) {
|
|
240
|
+
this.$refs.content.addEventListener('touchstart', this.onTouchStart);
|
|
241
|
+
this.$refs.content.addEventListener('touchmove', this.onTouchMove);
|
|
242
|
+
this.$refs.content.addEventListener('touchend', this.onTouchEnd)
|
|
243
|
+
}
|
|
244
|
+
window.addEventListener('resize', this.onResize)
|
|
245
|
+
},
|
|
246
|
+
unbindEvents(){
|
|
247
|
+
this.$refs.content.removeEventListener('touchstart', this.onTouchStart);
|
|
248
|
+
this.$refs.content.removeEventListener('touchmove', this.onTouchMove);
|
|
249
|
+
this.$refs.content.removeEventListener('touchend', this.onTouchEnd);
|
|
250
|
+
// window.removeEventListener('scroll', this.onScroll);
|
|
251
|
+
window.removeEventListener('resize', this.onResize)
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
beforeDestroy(){
|
|
255
|
+
this.unbindEvents()
|
|
256
|
+
},
|
|
257
|
+
watch: {
|
|
258
|
+
index(val){
|
|
259
|
+
this.startIndex = val
|
|
260
|
+
},
|
|
261
|
+
startIndex(val){
|
|
262
|
+
this.translateX = -val * this.clientWidth;
|
|
263
|
+
},
|
|
264
|
+
list(val) {
|
|
265
|
+
this.items = val;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-spinner-blade" :style="spinnerStyle">
|
|
3
|
+
<div class="blade" :class="'blade-' + i" :style="bladeStyle" v-for="i in 12"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script type="text/ecmascript-6">
|
|
8
|
+
import props from '../props';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
mixins: [props],
|
|
12
|
+
computed: {
|
|
13
|
+
bladeStyle() {
|
|
14
|
+
if (this.color) {
|
|
15
|
+
return {
|
|
16
|
+
backgroundColor: this.color,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-spinner-double-bounce" :style="spinnerStyle">
|
|
3
|
+
<div class="bounce" :class="'bounce-' + i" :style="bounceStyle" v-for="i in 2"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import props from '../props';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
mixins: [props],
|
|
12
|
+
computed: {
|
|
13
|
+
bounceStyle() {
|
|
14
|
+
if (this.color) {
|
|
15
|
+
return {
|
|
16
|
+
backgroundColor: this.color
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-spinner-fading-circle" :style="spinnerStyle">
|
|
3
|
+
<div class="block" :class="'block-' + i" v-for="i in 12">
|
|
4
|
+
<div class="circle" :class="'circle-' + i" :style="circleStyle"></div>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script type="text/ecmascript-6">
|
|
10
|
+
import props from '../props';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
mixins: [props],
|
|
14
|
+
computed: {
|
|
15
|
+
circleStyle() {
|
|
16
|
+
if (this.color) {
|
|
17
|
+
return {
|
|
18
|
+
backgroundColor: this.color,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
methods: {
|
|
24
|
+
blockStyle(index) {
|
|
25
|
+
return {
|
|
26
|
+
transform: 'rotate(' + 30 * index + 'deg)'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
circleStyle(index) {
|
|
30
|
+
return {
|
|
31
|
+
backgroundColor: this.spinnerColor,
|
|
32
|
+
animationDelay: (1.2 / 12 * index - 1.2) + 's'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-spinner-snake" :style="spinnerStyle"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import props from '../props';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
mixins: [props],
|
|
10
|
+
computed: {
|
|
11
|
+
spinnerStyle() {
|
|
12
|
+
let style = {};
|
|
13
|
+
|
|
14
|
+
if (this.size) {
|
|
15
|
+
let size = Math.ceil(this.size / 8);
|
|
16
|
+
|
|
17
|
+
style.height = this.size + 'px';
|
|
18
|
+
style.width = this.size + 'px';
|
|
19
|
+
style.borderWidth = size + 'px';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (this.color) {
|
|
23
|
+
style.borderTopColor = this.color;
|
|
24
|
+
style.borderLeftColor = this.color;
|
|
25
|
+
style.borderBottomColor = this.color;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return style;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-spinner-triple-bounce" :style="spinnerStyle">
|
|
3
|
+
<div class="bounce" :class="'bounce-' + i" :style="bounceStyle" v-for="i in 3"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script type="text/ecmascript-6">
|
|
8
|
+
import props from '../props';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
mixins: [props],
|
|
12
|
+
computed: {
|
|
13
|
+
unitSize() {
|
|
14
|
+
if (this.size) {
|
|
15
|
+
return Math.round(this.size / 6) * 2;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
spinnerStyle() {
|
|
19
|
+
if (this.size) {
|
|
20
|
+
return {
|
|
21
|
+
padding: (this.size - this.unitSize) / 2 + 'px 0'
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
bounceStyle() {
|
|
26
|
+
var style = {};
|
|
27
|
+
|
|
28
|
+
if (this.size) {
|
|
29
|
+
style.width = this.unitSize + 'px';
|
|
30
|
+
style.height = this.unitSize + 'px';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (this.color) {
|
|
34
|
+
style.backgroundColor = this.color;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return style;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by admin on 2017/6/16.
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
size: {
|
|
7
|
+
type: [Number, String],
|
|
8
|
+
coerce: Number
|
|
9
|
+
},
|
|
10
|
+
color: {
|
|
11
|
+
type: String
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
},
|
|
15
|
+
computed: {
|
|
16
|
+
spinnerStyle() {
|
|
17
|
+
if (this.size) {
|
|
18
|
+
return {
|
|
19
|
+
height: this.size + 'px',
|
|
20
|
+
width: this.size + 'px'
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="spinner" :type="type" :size="size" :color="color"></component>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
const SPINNERS = [
|
|
7
|
+
'blade',
|
|
8
|
+
'snake',
|
|
9
|
+
'double-bounce',
|
|
10
|
+
'triple-bounce',
|
|
11
|
+
'fading-circle'
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const parseSpinner = function (index) {
|
|
18
|
+
index = index || 0;
|
|
19
|
+
|
|
20
|
+
if (/^\d+$/.test(index)) {
|
|
21
|
+
if (SPINNERS.length <= index) {
|
|
22
|
+
console.warn(`'${index}' spinner not found, use the default spinner.`);
|
|
23
|
+
index = 0;
|
|
24
|
+
}
|
|
25
|
+
return SPINNERS[index];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (SPINNERS.indexOf(index) === -1) {
|
|
29
|
+
console.warn(`'${index}' spinner not found, use the default spinner.`);
|
|
30
|
+
index = SPINNERS[0];
|
|
31
|
+
}
|
|
32
|
+
return index;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
import SpinnerBlade from './behavior/blade.vue'
|
|
37
|
+
import SpinnerSnake from './behavior/snake.vue'
|
|
38
|
+
import SpinnerDoubleBounce from './behavior/double-bounce.vue'
|
|
39
|
+
import SpinnerTripleBounce from './behavior/triple-bounce.vue'
|
|
40
|
+
import SpinnerFadingCircle from './behavior/fading-circle.vue'
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
name: 'Spinner',
|
|
44
|
+
props: {
|
|
45
|
+
size: {
|
|
46
|
+
type: [Number, String],
|
|
47
|
+
default: 30
|
|
48
|
+
},
|
|
49
|
+
type: {
|
|
50
|
+
type: [String,Number],
|
|
51
|
+
default: 'snake',
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
color: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '#39f'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
computed: {
|
|
60
|
+
spinner(){
|
|
61
|
+
return `spinner-${parseSpinner(this.type)}`;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
components: {
|
|
65
|
+
SpinnerBlade,
|
|
66
|
+
SpinnerSnake,
|
|
67
|
+
SpinnerDoubleBounce,
|
|
68
|
+
SpinnerTripleBounce,
|
|
69
|
+
SpinnerFadingCircle
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|