sadais-piui 1.2.7-beta5 → 1.2.7-beta6
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.
|
@@ -119,6 +119,13 @@ export default {
|
|
|
119
119
|
// ''
|
|
120
120
|
default: datePicker.defaultValue
|
|
121
121
|
},
|
|
122
|
+
// 单位数组,默认值:['年', '月', '日', '时', '分', '秒']
|
|
123
|
+
units: {
|
|
124
|
+
type: Array,
|
|
125
|
+
default() {
|
|
126
|
+
return datePicker.units
|
|
127
|
+
}
|
|
128
|
+
},
|
|
122
129
|
// 返回的日期格式
|
|
123
130
|
format: {
|
|
124
131
|
type: String,
|
|
@@ -227,33 +234,40 @@ export default {
|
|
|
227
234
|
const itemHeight = uni.upx2px(this.itemHeight)
|
|
228
235
|
return `height: ${itemHeight}px;line-height: ${itemHeight}px;`
|
|
229
236
|
},
|
|
237
|
+
getUnits() {
|
|
238
|
+
return this.$pi.mergeDeep(datePicker.units, this.units, {
|
|
239
|
+
arrayMerge: (target, source, options) => {
|
|
240
|
+
return target.map((t, index) => source[index] || t)
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
},
|
|
230
244
|
columns() {
|
|
231
245
|
const monthDays = new Date(this.date.year, this.date.month, 0).getDate()
|
|
232
246
|
let columns = [
|
|
233
247
|
{
|
|
234
248
|
field: 'year',
|
|
235
|
-
unit:
|
|
249
|
+
unit: this.getUnits[0],
|
|
236
250
|
key: 'year',
|
|
237
251
|
setMethod: 'setYear',
|
|
238
252
|
items: this.$pi.common.generateArray(this.startYear, this.endYear)
|
|
239
253
|
},
|
|
240
254
|
{
|
|
241
255
|
field: 'month',
|
|
242
|
-
unit:
|
|
256
|
+
unit: this.getUnits[1],
|
|
243
257
|
key: 'month',
|
|
244
258
|
setMethod: 'setMonth',
|
|
245
259
|
items: this.$pi.common.generateArray(1, 12)
|
|
246
260
|
},
|
|
247
261
|
{
|
|
248
262
|
field: 'day',
|
|
249
|
-
unit:
|
|
263
|
+
unit: this.getUnits[2],
|
|
250
264
|
key: 'date',
|
|
251
265
|
setMethod: 'setDate',
|
|
252
266
|
items: this.$pi.common.generateArray(1, monthDays)
|
|
253
267
|
},
|
|
254
268
|
{
|
|
255
269
|
field: 'hour',
|
|
256
|
-
unit:
|
|
270
|
+
unit: this.getUnits[3],
|
|
257
271
|
key: 'hour',
|
|
258
272
|
setMethod: 'setHours',
|
|
259
273
|
type: 'time',
|
|
@@ -261,7 +275,7 @@ export default {
|
|
|
261
275
|
},
|
|
262
276
|
{
|
|
263
277
|
field: 'minute',
|
|
264
|
-
unit:
|
|
278
|
+
unit: this.getUnits[4],
|
|
265
279
|
key: 'minute',
|
|
266
280
|
setMethod: 'setMinutes',
|
|
267
281
|
type: 'time',
|
|
@@ -269,7 +283,7 @@ export default {
|
|
|
269
283
|
},
|
|
270
284
|
{
|
|
271
285
|
field: 'second',
|
|
272
|
-
unit:
|
|
286
|
+
unit: this.getUnits[5],
|
|
273
287
|
key: 'second',
|
|
274
288
|
setMethod: 'setSeconds',
|
|
275
289
|
type: 'time',
|
package/config/datePicker.js
CHANGED
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
field: 'day', // 选择器的粒度 year、month、day、hour、minute、second
|
|
13
13
|
dateType: 'datetime', // 日期类型,date、datetime、time(默认值:datetime)
|
|
14
14
|
defaultValue: '', // 日期默认值
|
|
15
|
+
units: ['年', '月', '日', '时', '分', '秒'], // 单位数组,默认值:['年', '月', '日', '时', '分', '秒']
|
|
15
16
|
format: '', // 返回的日期格式,为空的时候,返回的是日期对象
|
|
16
17
|
itemHeight: 110, // 行高(默认:'110rpx')
|
|
17
18
|
itemStyle: {}, // 行样式(默认:{})
|