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,223 @@
1
+ <template>
2
+
3
+
4
+ <div :class="classes">
5
+ <div class="header">
6
+ <div class="left" @click="cancle">取消</div>
7
+ <div class="title">请选择区域</div>
8
+ <div class="right" @click="sure">确定</div>
9
+ </div>
10
+
11
+ <div class="main">
12
+
13
+ <picker-slot :list="provinces" :init-item="province.code" :target="province.target"
14
+ @change="change"></picker-slot>
15
+
16
+ <picker-slot :list="citys" :init-item="city.code" :target="city.target" @change="change"></picker-slot>
17
+
18
+ <picker-slot :list="districts" :init-item="district.code" :target="district.target"
19
+ @change="change"></picker-slot>
20
+
21
+ </div>
22
+ </div>
23
+
24
+
25
+ </template>
26
+
27
+ <script>
28
+ import CHINA_AREA from 'china-area-data'
29
+ import pickerSlot from '../picker-slot'
30
+ import Emitter from '../../../mixin/emitter'
31
+ import props from './props'
32
+
33
+ const prefixCls = 'dpzvc-picker';
34
+ const rootCode = '86'
35
+ export default {
36
+ name: 'AreaPicker',
37
+ mixins: [Emitter, props],
38
+
39
+ data(){
40
+
41
+ return {
42
+ currentValue: this.addressValue,
43
+ province: {
44
+ value: '北京市',
45
+ code: '110000',
46
+ target: 'province',
47
+ index: 0
48
+ },
49
+
50
+ city: {
51
+ value: '市辖区',
52
+ code: '110100',
53
+ target: 'city',
54
+ index: 0
55
+ },
56
+
57
+ district: {
58
+ value: '东城区',
59
+ code: '110101',
60
+ target: 'district',
61
+ index: 0
62
+ },
63
+ }
64
+ },
65
+ mounted(){
66
+ this.initVal();
67
+ },
68
+
69
+ methods: {
70
+ initVal(){
71
+
72
+ if ((this.valueSeparator || this.valueSeparator != '') && this.currentValue && this.currentValue != '') {
73
+
74
+ let [provinceName, cityName, districtName] = this.currentValue.split(this.valueSeparator)
75
+
76
+
77
+ if (provinceName || cityName || districtName) {
78
+ let provinces = CHINA_AREA[rootCode]
79
+ if (!!provinces && provinces != undefined)
80
+ Object.keys(provinces).forEach((item)=>{
81
+ if (!isNaN(provinceName) && !!provinceName) {
82
+ if (provinceName == item) {
83
+ this.province.value = provinces[item];
84
+ this.province.code = item;
85
+ }
86
+ } else {
87
+ if (provinceName == provinces[item]) {
88
+ this.province.value = provinces[item];
89
+ this.province.code = item;
90
+ }
91
+ }
92
+ })
93
+
94
+
95
+ let citys = CHINA_AREA[this.province.code];
96
+ if (!!citys && citys != undefined)
97
+ Object.keys(citys).forEach((item)=>{
98
+ if (!isNaN(cityName) && !!cityName) {
99
+ if (cityName == item) {
100
+ this.city.value = citys[item];
101
+ this.city.code = item;
102
+ }
103
+ } else {
104
+ if (cityName == citys[item]) {
105
+ this.city.value = citys[item];
106
+ this.city.code = item;
107
+ }
108
+ }
109
+ })
110
+
111
+
112
+ let districts = CHINA_AREA[this.city.code];
113
+ if(!!districts && districts != undefined)
114
+ Object.keys(districts).forEach((item)=>{
115
+ if (!isNaN(districtName) && !!districtName) {
116
+ if (districtName == item) {
117
+ this.district.value = districts[item];
118
+ this.district.code = item;
119
+ }
120
+ } else {
121
+ if (districtName == citys[item]) {
122
+ this.district.value = districts[item];
123
+ this.district.code = item;
124
+ }
125
+ }
126
+ })
127
+
128
+ }
129
+ }
130
+
131
+ },
132
+ sure(){
133
+
134
+ this.dispatch('Picker', 'ok', {
135
+ province: {code: this.province.code, name: this.province.value},
136
+ city: {code: this.city.code, name: this.city.value},
137
+ district: {code: this.district.code, name: this.district.value},
138
+ formArea: [this.province.value, this.city.value, this.district.value].filter(x => !!x).join(this.valueSeparator)
139
+ })
140
+ },
141
+ cancle(){
142
+ this.dispatch('Picker', 'fail');
143
+ },
144
+ _filter(target, val = {}){
145
+ switch (target) {
146
+ case 'province':
147
+ let provinces = CHINA_AREA[rootCode];
148
+ if (!provinces && provinces == undefined) return [];
149
+
150
+ return Object.keys(provinces).map((item, index) => {
151
+ return {code:item,value:provinces[item],target:target,index:index}
152
+ });
153
+ break;
154
+ case 'city':
155
+ case 'district':
156
+ let list = CHINA_AREA[val.code];
157
+ if (!list && list == undefined && target) {
158
+ this[target] = {
159
+ value: '',
160
+ code: '',
161
+ target: target,
162
+ index:''
163
+ };
164
+
165
+ return []
166
+ };
167
+
168
+
169
+ return Object.keys(list).map((item, index) => {
170
+ return {code:item,value:list[item],target:target,index:index}
171
+ })
172
+ break;
173
+ }
174
+ },
175
+ change(target, current){
176
+
177
+ this.$nextTick(() => {
178
+ this[target] = Object.assign({}, this[target], current);
179
+
180
+ this.dispatch('Picker', 'parentchange', {
181
+ province: {code: this.province.code, name: this.province.value},
182
+ city: {code: this.city.code, name: this.city.value},
183
+ district: {code: this.district.code, name: this.district.value},
184
+ })
185
+ })
186
+
187
+
188
+
189
+ },
190
+ },
191
+
192
+ watch: {
193
+ addressValue(val){
194
+ this.currentValue = val
195
+ this.initVal()
196
+
197
+ },
198
+
199
+ },
200
+ computed: {
201
+ classes(){
202
+ return [
203
+ `${prefixCls}`,
204
+ ]
205
+ },
206
+ provinces(){
207
+
208
+ return this._filter('province')
209
+ },
210
+ citys(){
211
+ return this._filter('city', this.province)
212
+ },
213
+ districts(){
214
+
215
+ return this._filter('district', this.city)
216
+ }
217
+ },
218
+ components: {
219
+ pickerSlot
220
+ },
221
+
222
+ }
223
+ </script>
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Created by admin on 2017/6/13.
3
+ */
4
+ export default {
5
+ props: {
6
+ addressValue:String,
7
+ styles: {
8
+ type: Object,
9
+ default: () => {
10
+ }
11
+ },
12
+ valueSeparator:{
13
+ type:String,
14
+ default:'/'
15
+ }
16
+ },
17
+ }
@@ -0,0 +1,291 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <div class="header">
4
+ <div class="left" @click="cancle">取消</div>
5
+ <div class="right" @click="sure">确定</div>
6
+ </div>
7
+ <div class="main">
8
+ <picker-slot v-if="year" :list="yearList" :init-item="date.year.code" target="year" @change="change"></picker-slot>
9
+ <picker-slot v-if="month" :list="monthList" :init-item="date.month.code" target="month" @change="change"></picker-slot>
10
+ <picker-slot v-if="day" :list="dayList" :init-item="date.day.code" target="day" @change="change"></picker-slot>
11
+ </div>
12
+ </div>
13
+
14
+ </template>
15
+
16
+
17
+ <script>
18
+
19
+ import PickerSlot from '../picker-slot.vue'
20
+ import Emitter from '../../../mixin/emitter'
21
+ import props from './props'
22
+ const DAYS = {
23
+ 30: [4, 6, 9, 11],
24
+ 31: [1, 3, 5, 7, 8, 10, 12]
25
+ };
26
+ const prefixCls = 'dpzvc-date-picker';
27
+ export default {
28
+ name: 'DatePicker',
29
+ mixins: [Emitter,props],
30
+
31
+ data(){
32
+ return {
33
+ currentValue:this.dateValue,
34
+ // currentYear: this.year ? this.initYear : '',
35
+ // currentMonth: this.month ? this.initMonth : '',
36
+ // currentDay: this.day ? this.initDay : '',
37
+ date:{
38
+ year:{
39
+ code:new Date().getFullYear(),
40
+ value:String(new Date().getFullYear()),
41
+ target:'year',
42
+ index:0
43
+ },
44
+ month:{
45
+ code:new Date().getMonth() + 1,
46
+ value:String(new Date().getMonth() + 1),
47
+ target:'month',
48
+ index:0
49
+ },
50
+ day:{
51
+ code:new Date().getDate(),
52
+ value:String(new Date().getDate()),
53
+ target:'day',
54
+ index:0
55
+ },
56
+ formatDate:''
57
+ }
58
+
59
+ }
60
+ },
61
+ components: {
62
+ PickerSlot
63
+ },
64
+ methods: {
65
+ initVal(){
66
+
67
+ if ((this.valueSeparator || this.valueSeparator != '') && this.currentValue && this.currentValue != '') {
68
+ let [year = '',month = '',day = ''] = this.currentValue.split(this.valueSeparator)
69
+
70
+
71
+ this.date.year = Object.assign({},this.date.year,{code:Number(year),value:year})
72
+
73
+
74
+
75
+ this.date.month = Object.assign({},this.date.month,{code:Number(month),value:month})
76
+
77
+
78
+
79
+ this.date.day = Object.assign({},this.date.day,{code:Number(day),value:day})
80
+
81
+
82
+ if (!this.year) this.date.year = {}
83
+ if (!this.month) this.date.month = {}
84
+ if (!this.day) this.date.day = {}
85
+ }
86
+ },
87
+ cancle(){
88
+ this.dispatch('Picker', 'fail');
89
+ },
90
+ sure(){
91
+ console.log(this.date)
92
+ this.dispatch('Picker', 'ok',this.date)
93
+ },
94
+ change(target,current) {
95
+ this.$nextTick(()=>{
96
+ switch (target) {
97
+
98
+ case 'year':
99
+ let lastYear = this.yearList.length - 1;
100
+ if (current.index > this.yearList.length - 1) {
101
+ this.date.year = Object.assign(this.date.year,this.yearList[lastYear]);
102
+ } else {
103
+ this.date.year = Object.assign(this.date.year,current);
104
+ }
105
+ console.log(this.date.year)
106
+ // !!this.monthList ? this.currentMonth = this.monthList[0].code : '';
107
+ // !!this.dayList ? this.currentDay = this.dayList[0].code : '';
108
+
109
+
110
+ break;
111
+
112
+ case 'month':
113
+ let lastMonth = this.monthList.length -1;
114
+
115
+ if (current.index > this.monthList.length -1 ) {
116
+ this.date.month = Object.assign(this.date.month,this.monthList[lastMonth]);
117
+
118
+ } else {
119
+ this.date.month = Object.assign(this.date.month,current);
120
+
121
+ }
122
+
123
+
124
+ // !!this.dayList ? this.currentDay = this.dayList[0].code : '';
125
+
126
+ break;
127
+
128
+ case 'day':
129
+ let lastDay = this.dayList.length - 1;
130
+
131
+ if (current.index > this.dayList.length - 1) {
132
+ this.date.day = Object.assign(this.date.day,this.dayList[lastDay]);
133
+ } else {
134
+ this.date.day = Object.assign(this.date.day,current);
135
+
136
+ }
137
+
138
+
139
+ break;
140
+ }
141
+
142
+
143
+ console.log(this.date.year.value)
144
+ this.date.formatDate = [this.date.year.value,this.date.month.value,this.date.day.value].filter(x => !!x).join(this.valueSeparator)
145
+
146
+ })
147
+
148
+
149
+
150
+ }
151
+ },
152
+ mounted(){
153
+ this.initVal();
154
+ },
155
+ computed: {
156
+ classes(){
157
+ return [
158
+ `${prefixCls}`
159
+ ]
160
+ },
161
+ yearList(){
162
+ let from, to = 0;
163
+ if (!!this.year) {
164
+ from = 1900;
165
+ to = new Date().getFullYear();
166
+ if (Array.isArray(this.year)) {
167
+
168
+ if (this.year[0] !== undefined) from = this.year[0] <= this.year[1] ? this.year[0] : from;
169
+ if (this.year[1] !== undefined) to = this.year[0] <= this.year[1] ? this.year[1] : to;
170
+
171
+ }
172
+
173
+ let yearArr = [];
174
+ let index = 0;
175
+ for (let i = from; i <= to; i++) {
176
+ let y = String(i);
177
+ yearArr.push({
178
+ code:i,
179
+ value:y,
180
+ index:index,
181
+ target:'year'
182
+ })
183
+
184
+ index++;
185
+ }
186
+
187
+ return yearArr
188
+
189
+
190
+ }
191
+
192
+ return false;
193
+
194
+ },
195
+ monthList(){
196
+ let from,to = 0;
197
+ if (!!this.month) {
198
+ from = 1;
199
+ to = 12;
200
+ if (Array.isArray(this.month)) {
201
+
202
+ if (this.month[0] !== undefined) from = this.month[0] >= 1 && this.month[0]<this.month[1] ? this.month[0] : 1;
203
+ if (this.month[1] !== undefined) to = this.month[1] <= 12 && this.month[0]<this.month[1] ? this.month[1] : 12;
204
+ }
205
+
206
+ let monthArr = [];
207
+ let index = 0;
208
+ for (let i = from;i <= to;i++) {
209
+ let m = String(i);
210
+ monthArr.push({
211
+ code:i,
212
+ value:m,
213
+ index:index,
214
+ target:'month'
215
+ })
216
+
217
+ index++;
218
+ }
219
+
220
+
221
+
222
+ return monthArr
223
+ }
224
+
225
+ return false;
226
+ },
227
+ dayList(){
228
+ let from,to = 0;
229
+ if (!!this.day) {
230
+ from = 1;
231
+ to = 31;
232
+
233
+ if (!!this.date.month.value) {
234
+ let total;
235
+
236
+ if ( !!~DAYS[30].indexOf(this.date.month.value) ) {
237
+ total = 30;
238
+ } else if ( !!~DAYS[31].indexOf(this.date.month.value) ) {
239
+ total = 31;
240
+ } else {
241
+ let year = this.date.day.code;
242
+ if ((year%4 === 0 ) && (year%100 != 0 || year%400 === 0)) {
243
+ total = 29;
244
+ } else {
245
+ total = 28;
246
+ }
247
+ }
248
+
249
+ to = total;
250
+ }
251
+
252
+ if (Array.isArray(this.day)) {
253
+
254
+ if (this.day[0] !== undefined) from = this.day[0] >= 1 && this.day[0]<this.day[1] ? this.day[0] : 1;
255
+ if (this.day[1] !== undefined) to = this.day[1] <= 31 && this.day[0]<this.day[1] ? this.day[1] : 31;
256
+
257
+ }
258
+
259
+
260
+ let dayArr = [];
261
+ let index = 0;
262
+ for (let i = from;i <= to;i++) {
263
+ let d = String(i);
264
+ dayArr.push({
265
+ code:i,
266
+ value:d,
267
+ index:index,
268
+ target:'day'
269
+ })
270
+ index++;
271
+ }
272
+ return dayArr
273
+
274
+ }
275
+
276
+ return false;
277
+ }
278
+ },
279
+ watch:{
280
+ dateValue(val){
281
+ this.currentValue = val;
282
+ this.initVal();
283
+ }
284
+ }
285
+
286
+ }
287
+ </script>
288
+
289
+ <style lang="less">
290
+
291
+ </style>
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Created by admin on 2017/6/13.
3
+ */
4
+ export default {
5
+ props: {
6
+ dateValue:String,
7
+ year: {
8
+ type: [Boolean, Array],
9
+ default: true
10
+ },
11
+ month: {
12
+ type: [Boolean, Array],
13
+ default: true
14
+ },
15
+ day: {
16
+ type: [Boolean, Array],
17
+ default: true
18
+ },
19
+ valueSeparator:{
20
+ type:String,
21
+ default:'/'
22
+ }
23
+ },
24
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Created by admin on 2017/4/19.
3
+ */
4
+ import Picker from './picker'
5
+ export default Picker
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <div class="header">
4
+ <div class="left" @click="cancle">取消</div>
5
+ <div class="right" @click="sure">确定</div>
6
+ </div>
7
+ <div class="main">
8
+ <template v-if="shadowList.length">
9
+ <picker-slot v-for="(item,key) in shadowList" :target="item.target" :init-item="initItems[key]" :key="item.target" :list="item.list" @change="change"></picker-slot>
10
+ </template>
11
+
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import Emitter from '../../../mixin/emitter'
18
+ import PickerSlot from '../picker-slot.vue'
19
+ import props from './props'
20
+ const prefixCls = 'dpzvc-normal-picker'
21
+ export default {
22
+ name:'NormalPicker',
23
+ mixins:[Emitter,props],
24
+ data(){
25
+ return {
26
+ initItems:!!this.initArr.length ? this.initArr : this.list.map((item)=>{return item.list[0].code}),
27
+ normal:{}
28
+ }
29
+
30
+
31
+ },
32
+ methods:{
33
+ cancle(){
34
+ this.dispatch('Picker', 'fail');
35
+ },
36
+ sure(){
37
+ this.dispatch('Picker', 'ok',this.normal);
38
+ },
39
+ change(target,current){
40
+ this.$nextTick(()=>{
41
+ for(let i = 0;i < this.shadowList.length;i++) {
42
+
43
+ if(this.shadowList[i].target == target) {
44
+
45
+ for (let j = 0;i<this.shadowList[i].length;j++) {
46
+
47
+ if (current.code == this.shadowList[i].list[j].code) {
48
+ this.$set(this.initItems,i,this.shadowList[i].list[j].code)
49
+ break;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ this.normal = Object.assign({},this.normal,{[target]:current})
55
+
56
+
57
+ this.dispatch('Picker','scroll',current)
58
+ })
59
+
60
+ }
61
+ },
62
+ computed:{
63
+ classes(){
64
+ return [
65
+ `${prefixCls}`
66
+ ]
67
+ },
68
+ shadowList(){
69
+ let list = this.list;
70
+ for (let i = 0,listLength = list.length;i < listLength ;i++) {
71
+
72
+ if (list[i].hasOwnProperty('list') && list[i].list.length) {
73
+
74
+ for (let j = 0,childLength = list[i].list.length;j < childLength;j++) {
75
+
76
+ if (!list[i].list[j].hasOwnProperty('value')) return [];
77
+
78
+ if(!list[i].list[j].hasOwnProperty('code')) {
79
+ list[i].list[j].code = list[i].list[j].value
80
+ }
81
+
82
+
83
+
84
+ if(!list[i].list[j].hasOwnProperty('target')) {
85
+ list[i].list[j].target = list[i].target
86
+ }
87
+
88
+ list[i].list[j].index = j
89
+
90
+ }
91
+ }
92
+ }
93
+
94
+ return list
95
+ }
96
+ },
97
+
98
+ components:{
99
+ PickerSlot
100
+ },
101
+ watch:{
102
+ initArr(val){
103
+ this.initItems = !!this.initArr.length ? this.initArr : this.list.map((item)=>{return item.list[0].value})
104
+ },
105
+ }
106
+ }
107
+ </script>
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Created by admin on 2017/6/14.
3
+ */
4
+ export default {
5
+ props:{
6
+ list:{
7
+ type:Array,
8
+ default(){
9
+ return []
10
+ }
11
+ },
12
+ initArr:{
13
+ type:Array,
14
+ default(){
15
+ return []
16
+ }
17
+ }
18
+
19
+ }
20
+ }