@@ -6,7 +6,7 @@ import omit from 'lodash/omit';
66import createFieldsStore from './createFieldsStore' ;
77import { cloneElement } from '../../_util/vnode' ;
88import BaseMixin from '../../_util/BaseMixin' ;
9- import { getOptionProps , getEvents } from '../../_util/props-util' ;
9+ import { getOptionProps , getEvents , slotHasProp , getComponentName } from '../../_util/props-util' ;
1010import PropTypes from '../../_util/vue-types' ;
1111
1212import {
@@ -184,16 +184,27 @@ function createBaseForm(option = {}, mixins = []) {
184184 if ( process . env . NODE_ENV !== 'production' ) {
185185 const valuePropName = fieldMeta . valuePropName ;
186186 warning (
187- ! ( valuePropName in originalProps ) ,
187+ ! slotHasProp ( fieldElem , valuePropName ) ,
188188 `\`getFieldDecorator\` will override \`${ valuePropName } \`, ` +
189189 `so please don't set \`${ valuePropName } and v-model\` directly ` +
190190 `and use \`setFieldsValue\` to set it.` ,
191191 ) ;
192+ warning (
193+ ! (
194+ ! slotHasProp ( fieldElem , valuePropName ) &&
195+ valuePropName in originalProps &&
196+ ! ( fieldOption && fieldOption . initialValue )
197+ ) ,
198+ `${ getComponentName (
199+ fieldElem . componentOptions ,
200+ ) } \`default value\` can not collect, ` +
201+ ` please use \`option.initialValue\` to set default value.` ,
202+ ) ;
192203 const defaultValuePropName = `default${ valuePropName [ 0 ] . toUpperCase ( ) } ${ valuePropName . slice (
193204 1 ,
194205 ) } `;
195206 warning (
196- ! ( defaultValuePropName in originalProps ) ,
207+ ! slotHasProp ( fieldElem , defaultValuePropName ) ,
197208 `\`${ defaultValuePropName } \` is invalid ` +
198209 `for \`getFieldDecorator\` will set \`${ valuePropName } \`,` +
199210 ` please use \`option.initialValue\` instead.` ,
0 commit comments