|
|
@ -6,6 +6,7 @@ import { resolveConstructorOptions } from '../instance/init' |
|
|
|
import { resolveSlots } from '../instance/render-helpers/resolve-slots' |
|
|
|
|
|
|
|
import { |
|
|
|
tip, |
|
|
|
warn, |
|
|
|
isObject, |
|
|
|
hasOwn, |
|
|
@ -133,7 +134,7 @@ export function createComponent ( |
|
|
|
} |
|
|
|
|
|
|
|
// extract props
|
|
|
|
const propsData = extractProps(data, Ctor) |
|
|
|
const propsData = extractProps(data, Ctor, tag) |
|
|
|
|
|
|
|
// functional component
|
|
|
|
if (Ctor.options.functional) { |
|
|
@ -274,7 +275,7 @@ function resolveAsyncComponent ( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function extractProps (data: VNodeData, Ctor: Class<Component>): ?Object { |
|
|
|
function extractProps (data: VNodeData, Ctor: Class<Component>, tag?: string): ?Object { |
|
|
|
// we are only extracting raw values here.
|
|
|
|
// validation and default values are handled in the child
|
|
|
|
// component itself.
|
|
|
@ -293,12 +294,13 @@ function extractProps (data: VNodeData, Ctor: Class<Component>): ?Object { |
|
|
|
key !== keyInLowerCase && |
|
|
|
attrs && attrs.hasOwnProperty(keyInLowerCase) |
|
|
|
) { |
|
|
|
warn( |
|
|
|
`Prop "${keyInLowerCase}" is not declared in component ` + |
|
|
|
`${formatComponentName(Ctor)}. Note that HTML attributes are ` + |
|
|
|
`case-insensitive and camelCased props need to use their kebab-case ` + |
|
|
|
`equivalents when using in-DOM templates. You should probably use ` + |
|
|
|
`"${altKey}" instead of "${key}".` |
|
|
|
tip( |
|
|
|
`Prop "${keyInLowerCase}" is passed to component ` + |
|
|
|
`${formatComponentName(tag || Ctor)}, but the delared prop name is` + |
|
|
|
` "${key}". ` + |
|
|
|
`Note that HTML attributes are case-insensitive and camelCased ` + |
|
|
|
`props need to use their kebab-case equivalents when using in-DOM ` + |
|
|
|
`templates. You should probably use "${altKey}" instead of "${key}".` |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|