sadais-piui 1.2.6 → 1.2.7-beta3

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.
@@ -326,7 +326,7 @@ $unactive-color: #cccccc;
326
326
  opacity: $pi-disabled-opacity;
327
327
  }
328
328
  &.active {
329
- .radio-label {
329
+ .check-label {
330
330
  color: $pi-primary-color;
331
331
  }
332
332
  &.line,
@@ -218,17 +218,33 @@ export default {
218
218
  default() {
219
219
  return form.rightIcon
220
220
  }
221
+ },
222
+ // 表单校验规则
223
+ rules: {
224
+ type: Object,
225
+ default() {
226
+ return {}
227
+ }
221
228
  }
222
229
  },
223
230
  data() {
224
231
  return {
225
- rules: {}
232
+ validRules: {}
233
+ }
234
+ },
235
+ watch: {
236
+ rules: {
237
+ deep: true,
238
+ immediate: true,
239
+ handler(value) {
240
+ this.setRules(value)
241
+ }
226
242
  }
227
243
  },
228
244
  methods: {
229
245
  // 由于跨平台限制,无法通过props传递方法,通过refs方式在onReady生命周期设置校验规则
230
246
  setRules(rules) {
231
- this.rules = rules
247
+ this.validRules = rules
232
248
  },
233
249
  // 校验数据
234
250
  async validation() {
@@ -400,7 +400,7 @@ export default {
400
400
  // 从pi-form的rules属性中,取出当前pi-form-item的校验规则
401
401
  getRules() {
402
402
  // 父组件的所有规则
403
- const parentRules = this._parent ? this._parent.rules : undefined
403
+ const parentRules = this._parent && (this._parent.validRules || this._parent.rules)
404
404
  const rules = parentRules ? parentRules[this.prop] : []
405
405
  return [].concat(rules || [])
406
406
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.6",
3
+ "version": "1.2.7beta3",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,4 +23,3 @@
23
23
  },
24
24
  "homepage": "https://github.com/sadais-org/piui#readme"
25
25
  }
26
-