@@ -69,14 +69,9 @@ export default {
69
69
hasFeedback : false ,
70
70
autoLink : true ,
71
71
} ) ,
72
- provide ( ) {
73
- return {
74
- FormModelItemContext : this ,
75
- } ;
76
- } ,
77
72
inject : {
78
73
configProvider : { default : ( ) => ConfigConsumerProps } ,
79
- FormModelContext : { default : ( ) => ( { } ) } ,
74
+ FormContext : { default : ( ) => ( { } ) } ,
80
75
} ,
81
76
data ( ) {
82
77
return {
@@ -89,7 +84,7 @@ export default {
89
84
90
85
computed : {
91
86
fieldValue ( ) {
92
- const model = this . FormModelContext . model ;
87
+ const model = this . FormContext . model ;
93
88
if ( ! model || ! this . prop ) {
94
89
return ;
95
90
}
@@ -121,13 +116,13 @@ export default {
121
116
} ,
122
117
mounted ( ) {
123
118
if ( this . prop ) {
124
- const { addField } = this . FormModelContext ;
119
+ const { addField } = this . FormContext ;
125
120
addField && addField ( this ) ;
126
121
this . initialValue = cloneDeep ( this . fieldValue ) ;
127
122
}
128
123
} ,
129
124
beforeDestroy ( ) {
130
- const { removeField } = this . FormModelContext ;
125
+ const { removeField } = this . FormContext ;
131
126
removeField && removeField ( this ) ;
132
127
} ,
133
128
methods : {
@@ -153,13 +148,13 @@ export default {
153
148
this . validateState = errors ? 'error' : 'success' ;
154
149
this . validateMessage = errors ? errors [ 0 ] . message : '' ;
155
150
callback ( this . validateMessage , invalidFields ) ;
156
- this . FormModelContext &&
157
- this . FormModelContext . $emit &&
158
- this . FormModelContext . $emit ( 'validate' , this . prop , ! errors , this . validateMessage || null ) ;
151
+ this . FormContext &&
152
+ this . FormContext . $emit &&
153
+ this . FormContext . $emit ( 'validate' , this . prop , ! errors , this . validateMessage || null ) ;
159
154
} ) ;
160
155
} ,
161
156
getRules ( ) {
162
- let formRules = this . FormModelContext . rules ;
157
+ let formRules = this . FormContext . rules ;
163
158
const selfRules = this . rules ;
164
159
const requiredRule =
165
160
this . required !== undefined ? { required : ! ! this . required , trigger : 'change' } : [ ] ;
@@ -198,7 +193,7 @@ export default {
198
193
resetField ( ) {
199
194
this . validateState = '' ;
200
195
this . validateMessage = '' ;
201
- let model = this . FormModelContext . model || { } ;
196
+ let model = this . FormContext . model || { } ;
202
197
let value = this . fieldValue ;
203
198
let path = this . prop ;
204
199
if ( path . indexOf ( ':' ) !== - 1 ) {
0 commit comments