赞
踩
rule: [ { type: 'input', title: '货物总毛重(KG)', // label名称 field: 'totalGrossWt', // 字段名称 value: '', // input值, col: { span: 16, labelWidth: 50%}, className: 'total-gross-wt', props: { type: 'text', clearable: true, // 是否显示清空按钮 placeholder: '请输入...' }, validate: [{ pattern: /^(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/, // /^[0-9]+([.]{1}[0-9]{1,3})?$/, message: '请正确输入毛重,最多3位小数', trigger: 'blur' }] } ]
$f.updateRule
动态更新select类型表单的options不成功如果options有值,然后通过以下方式清空,无效,原因未知。目前改用$f.set
或者$f.model()
$f.updateRule('distDestPlace',{
options:[]
})
$f.updateRule
更新不成功可以用$f.set
或者$f.model()
// 例如动态设置select options的方法
this.updateSelectOption('distDestPlace', [])
updateSelectOption (field, value) {
let $f = this.model
let index = $f.fields().indexOf(field)
$f.set($f.rule[index], 'options', value)
},
或者
$f.model()[field].options = []
$f.bind
,$f.model
,Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。