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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/build-style.js +42 -0
  4. package/dist/dpzvc.js +17605 -0
  5. package/dist/styles/dpzvc.css +1 -0
  6. package/dist-prod/index.html +26 -0
  7. package/dist-prod/main.js +1 -0
  8. package/dist-prod/vendor.bundle.js +1 -0
  9. package/package.json +88 -0
  10. package/src/components/Indicator/Indicator.vue +77 -0
  11. package/src/components/Indicator/index.js +153 -0
  12. package/src/components/Text/Number.vue +201 -0
  13. package/src/components/Text/index.js +7 -0
  14. package/src/components/Text/textBar.vue +142 -0
  15. package/src/components/action-sheet/actionSheet.vue +91 -0
  16. package/src/components/action-sheet/index.js +5 -0
  17. package/src/components/app.vue +66 -0
  18. package/src/components/badge/badge.vue +77 -0
  19. package/src/components/badge/index.js +5 -0
  20. package/src/components/button/button.vue +122 -0
  21. package/src/components/button/index.js +5 -0
  22. package/src/components/card/card.vue +59 -0
  23. package/src/components/card/index.js +5 -0
  24. package/src/components/cell/cell.vue +103 -0
  25. package/src/components/cell/index.js +5 -0
  26. package/src/components/cell-swipe/cell-swipe.vue +148 -0
  27. package/src/components/cell-swipe/index.js +5 -0
  28. package/src/components/checkBox/checkbox-group.vue +76 -0
  29. package/src/components/checkBox/checkbox.vue +107 -0
  30. package/src/components/checkBox/index.js +8 -0
  31. package/src/components/header/header.vue +82 -0
  32. package/src/components/header/index.js +5 -0
  33. package/src/components/loadMore/index.js +5 -0
  34. package/src/components/loadMore/loadmore.vue +293 -0
  35. package/src/components/message/confirm.js +52 -0
  36. package/src/components/message/index.js +132 -0
  37. package/src/components/message/message.vue +135 -0
  38. package/src/components/message/messageGroup.vue +74 -0
  39. package/src/components/modal/confirm.js +161 -0
  40. package/src/components/modal/index.js +63 -0
  41. package/src/components/modal/modal.vue +144 -0
  42. package/src/components/picker/area-picker/area-picker.vue +223 -0
  43. package/src/components/picker/area-picker/props.js +17 -0
  44. package/src/components/picker/date-picker/date-picker.vue +291 -0
  45. package/src/components/picker/date-picker/props.js +24 -0
  46. package/src/components/picker/index.js +5 -0
  47. package/src/components/picker/normal-picker/normal-picker.vue +107 -0
  48. package/src/components/picker/normal-picker/props.js +20 -0
  49. package/src/components/picker/picker-slot.vue +206 -0
  50. package/src/components/picker/picker.vue +111 -0
  51. package/src/components/popup/index.js +5 -0
  52. package/src/components/popup/popup.vue +117 -0
  53. package/src/components/progress/index.js +5 -0
  54. package/src/components/progress/progress.vue +77 -0
  55. package/src/components/prompt/confirm.js +174 -0
  56. package/src/components/prompt/index.js +50 -0
  57. package/src/components/prompt/prompt.vue +166 -0
  58. package/src/components/radioBox/index.js +8 -0
  59. package/src/components/radioBox/radiobox-group.vue +74 -0
  60. package/src/components/radioBox/radiobox.vue +117 -0
  61. package/src/components/rater/index.js +5 -0
  62. package/src/components/rater/rater.vue +164 -0
  63. package/src/components/slideBar/index.js +6 -0
  64. package/src/components/slideBar/slideBar.vue +269 -0
  65. package/src/components/spinner/behavior/blade.vue +22 -0
  66. package/src/components/spinner/behavior/double-bounce.vue +22 -0
  67. package/src/components/spinner/behavior/fading-circle.vue +37 -0
  68. package/src/components/spinner/behavior/snake.vue +32 -0
  69. package/src/components/spinner/behavior/triple-bounce.vue +41 -0
  70. package/src/components/spinner/index.js +5 -0
  71. package/src/components/spinner/props.js +25 -0
  72. package/src/components/spinner/spinner.vue +74 -0
  73. package/src/components/swipe/index.js +5 -0
  74. package/src/components/swipe/swipe.vue +399 -0
  75. package/src/components/switchbar/index.js +5 -0
  76. package/src/components/switchbar/switchbar.vue +83 -0
  77. package/src/components/tab/index.js +6 -0
  78. package/src/components/tab/tab.vue +95 -0
  79. package/src/components/toTop/index.js +5 -0
  80. package/src/components/toTop/topTop.vue +76 -0
  81. package/src/components/upload/index.js +5 -0
  82. package/src/components/upload/upload.vue +200 -0
  83. package/src/config/config.js +17 -0
  84. package/src/directives/clickoutside.js +32 -0
  85. package/src/directives/tranferDom.js +65 -0
  86. package/src/index.js +83 -0
  87. package/src/lib/MegaPixImage.js +253 -0
  88. package/src/lib/exif.js +808 -0
  89. package/src/main.js +76 -0
  90. package/src/mixin/emitter.js +41 -0
  91. package/src/mixin/input.js +41 -0
  92. package/src/router.js +229 -0
  93. package/src/styles/base/font.less +99 -0
  94. package/src/styles/base/reset.less +69 -0
  95. package/src/styles/base/variable.less +108 -0
  96. package/src/styles/components/actionSheet.less +43 -0
  97. package/src/styles/components/badge.less +79 -0
  98. package/src/styles/components/button.less +123 -0
  99. package/src/styles/components/card.less +31 -0
  100. package/src/styles/components/cell-swipe.less +20 -0
  101. package/src/styles/components/cell.less +71 -0
  102. package/src/styles/components/checkBox.less +111 -0
  103. package/src/styles/components/editor.less +3 -0
  104. package/src/styles/components/header.less +70 -0
  105. package/src/styles/components/indicator.less +37 -0
  106. package/src/styles/components/loadmore.less +48 -0
  107. package/src/styles/components/message.less +57 -0
  108. package/src/styles/components/modal.less +82 -0
  109. package/src/styles/components/number.less +58 -0
  110. package/src/styles/components/picker.less +150 -0
  111. package/src/styles/components/popup.less +46 -0
  112. package/src/styles/components/progress.less +50 -0
  113. package/src/styles/components/prompt.less +37 -0
  114. package/src/styles/components/radioBox.less +136 -0
  115. package/src/styles/components/slide-Bar.less +147 -0
  116. package/src/styles/components/spinner.less +328 -0
  117. package/src/styles/components/swipe.less +125 -0
  118. package/src/styles/components/switchBar.less +88 -0
  119. package/src/styles/components/tab.less +69 -0
  120. package/src/styles/components/text.less +80 -0
  121. package/src/styles/components/toTop.less +26 -0
  122. package/src/styles/components/upload.less +23 -0
  123. package/src/styles/index.less +38 -0
  124. package/src/styles/utils/1px.less +204 -0
  125. package/src/styles/utils/animation.less +131 -0
  126. package/src/styles/utils/nowrap.less +19 -0
  127. package/src/template/index.ejs +26 -0
  128. package/src/utils/util.js +203 -0
  129. package/src/vconsole-resources.min.js +6 -0
  130. package/src/vconsole-sources.min.js +6 -0
  131. package/src/vconsole.min.js +7 -0
  132. package/src/views/ActionSheet.vue +33 -0
  133. package/src/views/Badge.vue +40 -0
  134. package/src/views/Button.vue +40 -0
  135. package/src/views/Card.vue +52 -0
  136. package/src/views/Cell.vue +21 -0
  137. package/src/views/CellSwipe.vue +85 -0
  138. package/src/views/CheckBox.vue +53 -0
  139. package/src/views/Header.vue +47 -0
  140. package/src/views/Indicator.vue +69 -0
  141. package/src/views/LoadMore.vue +54 -0
  142. package/src/views/Message.vue +42 -0
  143. package/src/views/Modal.vue +32 -0
  144. package/src/views/Picker.vue +50 -0
  145. package/src/views/Popup.vue +87 -0
  146. package/src/views/Progress.vue +32 -0
  147. package/src/views/Prompt.vue +31 -0
  148. package/src/views/RadioBox.vue +55 -0
  149. package/src/views/Rater.vue +39 -0
  150. package/src/views/SlideBar.vue +47 -0
  151. package/src/views/Spinner.vue +15 -0
  152. package/src/views/Swipe.vue +34 -0
  153. package/src/views/SwitchBar.vue +36 -0
  154. package/src/views/Tab.vue +41 -0
  155. package/src/views/Text.vue +64 -0
  156. package/src/views/ToTop.vue +17 -0
  157. package/src/views/Upload.vue +44 -0
  158. package/src/views/guide.vue +159 -0
  159. package/src/views/index.vue +435 -0
  160. package/webpack.base.config.js +74 -0
  161. package/webpack.dev.config.js +67 -0
  162. package/webpack.dist.dev.config.js +44 -0
  163. package/webpack.dist.prod.config.js +50 -0
  164. package/webpack.prod.config.js +72 -0
@@ -0,0 +1,399 @@
1
+ <template>
2
+ <div :class="classes" :style="{height:height}">
3
+
4
+ <div :class="wrapperClasses" :style="styles" ref="wrapper" >
5
+ <div :class="itemClasses" v-for="(item,index) in arrayList" v-if="arrayList.length">
6
+ <template v-if="isMultiple">
7
+ <a :class="multipleClass" v-for="(_item,$index) in item" @click="choose(_item,$index,$event)">
8
+ <slot :item="_item" :index="$index">
9
+ <img :src="_item.image"/>
10
+ <span>{{_item.spec}}</span>
11
+ </slot>
12
+ </a>
13
+ </template>
14
+ <template v-else>
15
+ <a :class="singleClass" @click="choose(item,index,$event)">
16
+ <slot :item="item" :index="index">
17
+ <img :src="item.image">
18
+ <span>{{item.spec}}</span>
19
+ </slot>
20
+ </a>
21
+ </template>
22
+ </div>
23
+
24
+ </div>
25
+ <div :class="dotsClasses">
26
+ <span :class="['dpzvc-swipe-dots-item',(loop?(index+1):index)==slideIndex?'active':'']"
27
+ v-for="(item,index) in dotLength"></span>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+
34
+ const prefixCls = 'dpzvc-swipe';
35
+ export default {
36
+ props: {
37
+ auto: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ list: {
42
+ type: Array,
43
+ default: () => []
44
+ },
45
+ startIndex: {
46
+ type: Number,
47
+ default: 0
48
+ },
49
+ height: {
50
+ type: [Number, String],
51
+ default: 'auto'
52
+ },
53
+ dots: {
54
+ type: String,
55
+ default: 'bottom'
56
+ },
57
+ multiple: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ distanceIndex: {
62
+ type: Number,
63
+ default: 1.5
64
+ },
65
+ loop: {
66
+ type: Boolean,
67
+ default: true
68
+ },
69
+ speed: {
70
+ type: Number,
71
+ default: 2
72
+ },
73
+ perpage: {
74
+ type: Number,
75
+ default: 1
76
+ }
77
+
78
+ },
79
+ data(){
80
+ return {
81
+ translateX: 0,
82
+ currentTranslateX: 0,
83
+ dragging: false,
84
+ autoSwipe: true,
85
+ startX: 0,
86
+ currentX: 0,
87
+ clientWidth: 0,
88
+ slideIndex: this.loop ? this.startIndex + 1 : this.startIndex,
89
+ distance: 0,
90
+ timer: null,
91
+ clientHeight: 0,
92
+ localList: this.list
93
+ }
94
+ },
95
+ watch:{
96
+ list(val){
97
+ this.localList = val
98
+ },
99
+ startIndex(val){
100
+ this.slideIndex = val
101
+ }
102
+ },
103
+ computed: {
104
+ dotLength(){
105
+ return this.localList.length
106
+ },
107
+ minIndex(){
108
+ return this.loop ? 1 : 0
109
+ },
110
+ maxIndex(){
111
+ return this.loop ? this.length - 2 : this.length - 1
112
+ },
113
+ arrayList(){
114
+ if (!this.localList.length) return [];
115
+ if (this.loop) {
116
+ return [].concat([this.localList[this.localList.length - 1]], this.localList, [this.localList[0]])
117
+ } else {
118
+ return this.localList
119
+ }
120
+ },
121
+
122
+ classes(){
123
+ return [
124
+ `${prefixCls}`,
125
+ ]
126
+ },
127
+ wrapperClasses(){
128
+ return [
129
+ `${prefixCls}-wrapper`,
130
+ {
131
+ [`${prefixCls}-dragging`]: this.dragging,
132
+ [`${prefixCls}-dragging`]: !this.autoSwipe,
133
+ }
134
+ ]
135
+ },
136
+ multipleClass(){
137
+ return [
138
+ `${prefixCls}-multiple`
139
+ ]
140
+ },
141
+ singleClass(){
142
+ return [
143
+ `${prefixCls}-single`
144
+ ]
145
+ },
146
+ dotsClasses(){
147
+ return [
148
+ `${prefixCls}-dots`,
149
+ {
150
+ [`${prefixCls}-dots-bottom`]: this.dots === 'bottom',
151
+ [`${prefixCls}-dots-top`]: this.dots === 'top'
152
+ }
153
+ ]
154
+ },
155
+
156
+ itemClasses(){
157
+ return [
158
+ `${prefixCls}-item`,
159
+ {
160
+ [`multiple`]: this.isMultiple,
161
+ }
162
+ ]
163
+ },
164
+ isMultiple(){
165
+
166
+ if (this.perpage <= 1) {
167
+ return false;
168
+ } else {
169
+ const page = this.perpage;
170
+ let arr = [];
171
+ let multipleArr = [];
172
+ this.localList.forEach((item, index) => {
173
+ if (arr.length < page) {
174
+ arr.push(item);
175
+ if (this.localList.length - 1 === index) {
176
+ multipleArr.push(arr);
177
+ }
178
+ } else {
179
+ multipleArr.push(arr);
180
+ arr = [];
181
+ arr.push(item)
182
+ }
183
+ });
184
+
185
+ this.localList = multipleArr;
186
+ return true;
187
+ }
188
+ },
189
+ styles(){
190
+
191
+ return {
192
+
193
+ width: `${this.length * this.clientWidth}px`,
194
+ height: Object.is(Number.parseInt(this.height), NaN) ? `${this.height}` : `${this.height}px`,
195
+ transform: `translate3d(${this.translateX}px,0,0)`
196
+ }
197
+ },
198
+ length(){
199
+ return this.loop ? this.localList.length + 2 : this.localList.length
200
+ },
201
+ currentIndex(){
202
+
203
+ return Math.ceil(this.translateX / this.clientWidth)
204
+ }
205
+ },
206
+ methods: {
207
+
208
+ choose(item, index,e) {
209
+ if (item.onClick && typeof item.onClick == 'function') {
210
+
211
+ item.onClick(item, index)
212
+ } else if(item.link){
213
+
214
+ if (/(https|http)/i.test(item.link)){
215
+
216
+ window.location.href = item.link
217
+ } else if(this.$router){
218
+ let matchLink = this.$router.match(item.link)
219
+
220
+ if (!!matchLink.matched.length) {
221
+
222
+ e.preventDefault();
223
+ this.$router.push(item.link)
224
+ }
225
+ }
226
+
227
+
228
+ }
229
+ },
230
+
231
+ onLoopSlideLeft(){
232
+ this.translateX = this.currentTranslateX - this.clientWidth;
233
+ if (++this.slideIndex > this.maxIndex) {
234
+ this.slideIndex--;
235
+ this.$refs.wrapper.addEventListener('webkitTransitionEnd', this.resetSlide, false);
236
+ }
237
+ },
238
+ onLoopSlideRight(){
239
+ this.translateX = this.currentTranslateX + this.clientWidth
240
+ if (--this.slideIndex < this.minIndex) {
241
+ this.slideIndex++;
242
+ this.$refs.wrapper.addEventListener('webkitTransitionEnd', this.resetSlideMax, false);
243
+ }
244
+ },
245
+ onSlideLeft(){
246
+ if (++this.slideIndex > this.maxIndex) {
247
+ this.slideIndex--;
248
+ this.translateX = this.currentTranslateX
249
+ } else {
250
+
251
+ this.translateX = this.currentTranslateX - this.clientWidth
252
+ }
253
+ },
254
+
255
+ onSlideRight(){
256
+ if (--this.slideIndex < this.minIndex) {
257
+ this.slideIndex++;
258
+ this.translateX = this.currentTranslateX
259
+ } else {
260
+
261
+ this.translateX = this.currentTranslateX + this.clientWidth
262
+ }
263
+ },
264
+
265
+ onTouchStart(e){
266
+ // e.preventDefault();
267
+ this.dragging = true;
268
+ this.autoSwipe = false;
269
+ this.startX = e.touches[0].clientX;
270
+ this.currentTranslateX = this.translateX;
271
+ this.distance = 0;
272
+
273
+ if (this.timer && this.auto) {
274
+ this.clearTimer();
275
+ }
276
+ },
277
+
278
+ onTouchMove(e){
279
+ e.preventDefault();
280
+ this.currentX = e.touches[0].clientX;
281
+
282
+
283
+ if (this.distanceIndex) this.distance = (this.currentX - this.startX) / this.distanceIndex;
284
+ else this.distance = this.currentX - this.startX;
285
+
286
+ this.translateX = this.currentTranslateX + this.distance
287
+
288
+ },
289
+
290
+
291
+ onTouchEnd(e){
292
+ // e.preventDefault();
293
+ if (this.distance < 0 && Math.abs(this.distance) > this.clientWidth / 5) {
294
+
295
+ this.loop && this.auto ? this.onLoopSlideLeft() : this.onSlideLeft()
296
+
297
+ } else if (this.distance > 0 && Math.abs(this.distance) > this.clientWidth / 5) {
298
+
299
+ this.loop && this.auto ? this.onLoopSlideRight() : this.onSlideRight()
300
+
301
+ } else {
302
+
303
+ this.translateX = this.currentTranslateX
304
+ }
305
+ this.dragging = false;
306
+ this.autoSwipe = true;
307
+ if (this.auto) {
308
+ this.autoSlide()
309
+ }
310
+
311
+ },
312
+
313
+ onResize(){
314
+ this.clientWidth = this.$el.clientWidth;
315
+ this.clientHeight = getComputedStyle(this.$el.querySelector('.dpzvc-swipe-wrapper')).height;
316
+ },
317
+ resetSlide(){
318
+
319
+ this.$refs.wrapper.removeEventListener('webkitTransitionEnd', this.resetSlide, false);
320
+
321
+ this.slideIndex = this.minIndex;
322
+ this.autoSwipe = false;
323
+ this.translateX = -this.slideIndex * this.clientWidth;
324
+ setTimeout(() => {
325
+ this.autoSwipe = true;
326
+ }, 0)
327
+
328
+ },
329
+
330
+ resetSlideMax(){
331
+
332
+ this.$refs.wrapper.removeEventListener('webkitTransitionEnd', this.resetSlideMax, false);
333
+ this.slideIndex = this.maxIndex;
334
+ this.autoSwipe = false;
335
+ this.translateX = -this.slideIndex * this.clientWidth;
336
+ setTimeout(() => {
337
+ this.autoSwipe = true;
338
+ }, 0)
339
+ },
340
+ autoSlide(){
341
+
342
+ this.timer = setTimeout(() => {
343
+
344
+
345
+ if (!this.dragging && this.autoSwipe) {
346
+ this.translateX -= this.clientWidth;
347
+ if (++this.slideIndex > this.maxIndex) {
348
+
349
+ this.slideIndex--;
350
+ this.$refs.wrapper.addEventListener('webkitTransitionEnd', this.resetSlide, false);
351
+ }
352
+
353
+ this.autoSlide();
354
+ }
355
+ }, this.speed < 1 ? 1000 : this.speed * 1000
356
+ )
357
+
358
+ },
359
+ clearTimer(){
360
+
361
+ if (this.timer) clearTimeout(this.timer);
362
+ this.timer = null;
363
+ },
364
+
365
+ bindEvent()
366
+ {
367
+ this.$refs.wrapper.addEventListener('touchstart', this.onTouchStart, false);
368
+ this.$refs.wrapper.addEventListener('touchmove', this.onTouchMove, false);
369
+ this.$refs.wrapper.addEventListener('touchend', this.onTouchEnd, false)
370
+ window.addEventListener('resize',this.onResize)
371
+ }
372
+ ,
373
+ unbindEvent()
374
+ {
375
+ this.$refs.wrapper.removeEventListener('touchstart', this.onTouchStart, false);
376
+ this.$refs.wrapper.removeEventListener('touchmove', this.onTouchMove, false);
377
+ this.$refs.wrapper.removeEventListener('touchend', this.onTouchEnd, false)
378
+ window.removeEventListener('resize',this.onResize)
379
+ }
380
+ },
381
+ mounted()
382
+ {
383
+
384
+ this.clientWidth = this.$el.clientWidth;
385
+ this.clientHeight = getComputedStyle(this.$el.querySelector('.dpzvc-swipe-wrapper')).height;
386
+ if (this.auto) this.autoSlide();
387
+
388
+ this.bindEvent()
389
+ }
390
+ ,
391
+ beforeDestroy()
392
+ {
393
+ this.unbindEvent();
394
+ this.clearTimer();
395
+ }
396
+
397
+ }
398
+ </script>
399
+
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/5/26.
3
+ */
4
+ import SwitchBar from './switchbar'
5
+ export default SwitchBar
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <input type="checkbox" v-model="currentValue" :id="name" :class="inputCheckClasses">
4
+ <label :for="name" :class="sizeClasses"></label>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import {random_str} from '../../utils/util'
10
+ const prefixCls = 'dpzvc-switch';
11
+ export default {
12
+ name:'SwitchBar',
13
+ props: {
14
+ id:{
15
+ type:String,
16
+ },
17
+ value:{
18
+ type:Boolean,
19
+ default:false
20
+ },
21
+ size:{
22
+ type:String,
23
+ default:'small',
24
+ validator(val){
25
+ return ['small','large'].indexOf(val) > -1
26
+ }
27
+ }
28
+ },
29
+ data(){
30
+ return {
31
+ name:this.id,
32
+ currentValue:this.value
33
+ }
34
+ },
35
+ computed:{
36
+ classes(){
37
+ return [
38
+ `${prefixCls}`
39
+ ]
40
+ },
41
+ inputCheckClasses(){
42
+ return [
43
+ `${prefixCls}-checkbox`,
44
+ 'hidden'
45
+
46
+ ]
47
+ },
48
+ sizeClasses(){
49
+ return [
50
+ `${prefixCls}-ui`,
51
+ {
52
+ ['small']:this.size === 'small'
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ mounted(){
58
+
59
+ if (!this.id) {
60
+ this.name = Date.now()+"_"+random_str();
61
+ }
62
+
63
+ },
64
+ watch:{
65
+ value(val){
66
+
67
+ this.currentValue = val
68
+
69
+ },
70
+
71
+ id(val){
72
+ this.name=val
73
+ },
74
+
75
+ currentValue(val){
76
+
77
+ this.$emit('input',val)
78
+
79
+ }
80
+
81
+ }
82
+ }
83
+ </script>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Created by admin on 2017/5/15.
3
+ */
4
+ import Tab from './tab.vue'
5
+
6
+ export default Tab
@@ -0,0 +1,95 @@
1
+ <template>
2
+
3
+ <div :class="classes" v-show="show" :style="getStyles">
4
+ <ul>
5
+ <li v-for="(item, index) in items" :key="index">
6
+ <template v-if="/(http|https)/i.test(item.path)">
7
+ <a :href="item.path" :class="itemClass(item, index)">
8
+ <span v-html="getIconHtml(item, index)"></span>
9
+ <p>{{item.name}}</p>
10
+ </a>
11
+ </template>
12
+
13
+ <template v-else>
14
+ <router-link tag="a" :to="item.path" :class="itemClass(item, index)">
15
+ <slot name="item">
16
+ <span v-html="getIconHtml(item, index)"></span>
17
+ <p>{{item.name}}</p>
18
+ </slot>
19
+ </router-link>
20
+ </template>
21
+ </li>
22
+
23
+ </ul>
24
+
25
+ </div>
26
+
27
+
28
+
29
+ </template>
30
+
31
+ <script>
32
+ const prefixCls = 'dpzvc-tab';
33
+ export default {
34
+ props: {
35
+ items: Array,
36
+ value: {
37
+ type: Boolean,
38
+ default: true
39
+ },
40
+ index: {
41
+ type: [Number, String],
42
+ default: 0
43
+ },
44
+ border: {
45
+ type: Boolean,
46
+ default: true
47
+ },
48
+ styles: {
49
+ type: Object,
50
+ default(){
51
+ return {}
52
+ }
53
+ }
54
+ },
55
+ data(){
56
+ return {
57
+ show: this.value
58
+ }
59
+ },
60
+ computed: {
61
+ classes(){
62
+ return [
63
+ `${prefixCls}`
64
+ ]
65
+ },
66
+ getStyles() {
67
+ return Object.assign({}, this.styles)
68
+ }
69
+ },
70
+ watch: {
71
+ value(val){
72
+ this.show = val
73
+ }
74
+ },
75
+ methods: {
76
+ itemClass(item, index) {
77
+ var _class = [
78
+ 'tab-item-' + index
79
+ ];
80
+
81
+ if (this.index == index) _class.push('cur');
82
+
83
+ return _class;
84
+ },
85
+ getIconHtml(item, index) {
86
+ if (this.index == index) {
87
+ return item.iconCur || item.icon;
88
+ } else {
89
+ return item.icon;
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/6/29.
3
+ */
4
+ import ToTop from './topTop'
5
+ export default ToTop
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div :class="classes" :style="positionStyles" v-show="back" @click="toTop">
3
+ <slot>
4
+ <div :class="wrapperClasses"></div>
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ import {scrollTop} from '../../utils/util'
12
+ const prefixCls = 'dpzvc-toTop';
13
+ export default {
14
+ name:'toTop',
15
+ props:{
16
+ distance:{
17
+ type:Number,
18
+ default:200
19
+ },
20
+ bottom:{
21
+ type:[Number,String],
22
+ default:30
23
+ },
24
+ right:{
25
+ type:[Number,String],
26
+ default:30
27
+ },
28
+ duration:{
29
+ type:Number,
30
+ default:1000
31
+ }
32
+ },
33
+ data(){
34
+ return {
35
+ back:false
36
+ }
37
+ },
38
+ methods:{
39
+ toTop(){
40
+
41
+ scrollTop(window,window.pageYOffset,0,this.duration)
42
+ },
43
+ scroll(){
44
+ this.back = window.pageYOffset > this.distance
45
+ }
46
+ },
47
+ mounted(){
48
+ window.addEventListener('scroll',this.scroll,false);
49
+ window.addEventListener('resize',this.scroll,false);
50
+ },
51
+ beforeDestroy(){
52
+ window.removeEventListener('scroll',this.scroll,false);
53
+ window.removeEventListener('resize',this.scroll,false);
54
+ },
55
+ computed:{
56
+ classes(){
57
+ return [
58
+ `${prefixCls}`
59
+ ]
60
+
61
+ },
62
+ wrapperClasses(){
63
+ return [
64
+ `${prefixCls}-wrapper`
65
+ ]
66
+
67
+ },
68
+ positionStyles(){
69
+ return {
70
+ 'bottom':this.bottom+'px',
71
+ 'right':this.right+'px'
72
+ }
73
+ }
74
+ }
75
+ }
76
+ </script>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/5/26.
3
+ */
4
+ import Upload from './upload'
5
+ export default Upload