sadais-piui 1.2.7-beta3 → 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.
@@ -13,6 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import Emitter from '../../mixin/emitter'
16
17
  import ValueSync from '../../mixin/value-sync'
17
18
  import { parentInit } from '../../mixin/props-sync'
18
19
  import { getConfig } from '../../config'
@@ -24,6 +25,7 @@ export default {
24
25
  name: 'PiCheckboxGroup',
25
26
  // 混入自定义样式customStyle和customClass
26
27
  mixins: [
28
+ Emitter,
27
29
  ValueSync,
28
30
  parentInit([
29
31
  'value',
@@ -184,6 +186,8 @@ export default {
184
186
  })
185
187
  this.val = vals
186
188
  this.handleEmitChange()
189
+ this.dispatch('PiForm', 'form-change', this.val)
190
+ this.dispatch('PiFormItem', 'form-change', this.val)
187
191
  }
188
192
  }
189
193
  }
@@ -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',
@@ -449,7 +449,10 @@ export default {
449
449
  resolve(_getResolve())
450
450
  })
451
451
  .catch(({ errors, fields }) => {
452
- console.log(TAG, '表单校验失败', this.prop, errors, fields)
452
+ console.log(TAG, '表单校验失败', `字段名:${this.prop},字段值:${fieldValue}`)
453
+ console.log(TAG, '字段值:', fieldValue)
454
+ console.log(TAG, '错误信息', errors)
455
+ console.log(TAG, '校验规则', fields)
453
456
  // 记录状态和报错信息
454
457
  this.validateState = 'error'
455
458
  this.validateMessage = errors ? errors[0].message : ''
@@ -328,8 +328,8 @@ export default {
328
328
  handleChange(value) {
329
329
  this.val = value
330
330
  this.handleEmitChange()
331
- this.dispatch('PiForm', 'form-change', value)
332
- this.dispatch('PiFormItem', 'form-change', value)
331
+ this.dispatch('PiForm', 'form-change', this.val)
332
+ this.dispatch('PiFormItem', 'form-change', this.val)
333
333
  }
334
334
  }
335
335
  }
@@ -15,6 +15,7 @@
15
15
  </template>
16
16
 
17
17
  <script>
18
+ import Emitter from '../../mixin/emitter'
18
19
  import ValueSync from '../../mixin/value-sync'
19
20
  import { parentInit } from '../../mixin/props-sync'
20
21
  import { getConfig } from '../../config'
@@ -26,6 +27,7 @@ export default {
26
27
  name: 'PiRadioGroup',
27
28
  // 混入自定义样式customStyle和customClass
28
29
  mixins: [
30
+ Emitter,
29
31
  ValueSync,
30
32
  // parentInit 混入子组件要继承的属性
31
33
  parentInit([
@@ -181,6 +183,8 @@ export default {
181
183
  this.val = childName
182
184
  }
183
185
  this.handleEmitChange()
186
+ this.dispatch('PiForm', 'form-change', this.val)
187
+ this.dispatch('PiFormItem', 'form-change', this.val)
184
188
  }
185
189
  }
186
190
  }
@@ -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: {}, // 行样式(默认:{})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta3",
3
+ "version": "1.2.7beta6",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {