@@ -69,14 +69,9 @@ export default {
6969 hasFeedback : false ,
7070 autoLink : true ,
7171 } ) ,
72- provide ( ) {
73- return {
74- FormModelItemContext : this ,
75- } ;
76- } ,
7772 inject : {
7873 configProvider : { default : ( ) => ConfigConsumerProps } ,
79- FormModelContext : { default : ( ) => ( { } ) } ,
74+ FormContext : { default : ( ) => ( { } ) } ,
8075 } ,
8176 data ( ) {
8277 return {
@@ -89,7 +84,7 @@ export default {
8984
9085 computed : {
9186 fieldValue ( ) {
92- const model = this . FormModelContext . model ;
87+ const model = this . FormContext . model ;
9388 if ( ! model || ! this . prop ) {
9489 return ;
9590 }
@@ -121,13 +116,13 @@ export default {
121116 } ,
122117 mounted ( ) {
123118 if ( this . prop ) {
124- const { addField } = this . FormModelContext ;
119+ const { addField } = this . FormContext ;
125120 addField && addField ( this ) ;
126121 this . initialValue = cloneDeep ( this . fieldValue ) ;
127122 }
128123 } ,
129124 beforeDestroy ( ) {
130- const { removeField } = this . FormModelContext ;
125+ const { removeField } = this . FormContext ;
131126 removeField && removeField ( this ) ;
132127 } ,
133128 methods : {
@@ -153,13 +148,13 @@ export default {
153148 this . validateState = errors ? 'error' : 'success' ;
154149 this . validateMessage = errors ? errors [ 0 ] . message : '' ;
155150 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 ) ;
159154 } ) ;
160155 } ,
161156 getRules ( ) {
162- let formRules = this . FormModelContext . rules ;
157+ let formRules = this . FormContext . rules ;
163158 const selfRules = this . rules ;
164159 const requiredRule =
165160 this . required !== undefined ? { required : ! ! this . required , trigger : 'change' } : [ ] ;
@@ -198,7 +193,7 @@ export default {
198193 resetField ( ) {
199194 this . validateState = '' ;
200195 this . validateMessage = '' ;
201- let model = this . FormModelContext . model || { } ;
196+ let model = this . FormContext . model || { } ;
202197 let value = this . fieldValue ;
203198 let path = this . prop ;
204199 if ( path . indexOf ( ':' ) !== - 1 ) {
0 commit comments