| 166 | this.cache(key, value); |
| 167 | }, |
| 168 | addRule(i, emit) { |
| 169 | const rule = this.formCreateInject.form.copyRules(this.rule || []); |
| 170 | const options = this.options ? {...this.options} : { |
| 171 | submitBtn: false, |
| 172 | resetBtn: false, |
| 173 | }; |
| 174 | if (this.defaultValue) { |
| 175 | if (!options.formData) options.formData = {}; |
| 176 | const defVal = deepCopy(this.defaultValue); |
| 177 | extend(options.formData, this.field ? {[this.field]: defVal} : defVal); |
| 178 | } |
| 179 | this.parse && this.parse({rule, options, index: this.sort.length}); |
| 180 | this.cacheRule[++this.len] = {rule, options}; |
| 181 | this.sort = Object.keys(this.cacheRule); |
| 182 | if (emit) { |
| 183 | nextTick(() => this.$emit('add', rule, Object.keys(this.cacheRule).length - 1)); |
| 184 | } |
| 185 | }, |
| 186 | add$f(i, key, $f) { |
| 187 | this.cacheRule[key].$f = $f; |
| 188 | nextTick(() => { |