diff --git a/src/core/instance/state.js b/src/core/instance/state.js
index 6cef0b9139f..5b5aa1b5046 100644
--- a/src/core/instance/state.js
+++ b/src/core/instance/state.js
@@ -183,14 +183,23 @@ function createComputedGetter (key) {
}
function initMethods (vm: Component, methods: Object) {
+ const props = vm.$options.props
for (const key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm)
- if (process.env.NODE_ENV !== 'production' && methods[key] == null) {
- warn(
- `method "${key}" has an undefined value in the component definition. ` +
- `Did you reference the function correctly?`,
- vm
- )
+ if (process.env.NODE_ENV !== 'production') {
+ if (methods[key] == null) {
+ warn(
+ `method "${key}" has an undefined value in the component definition. ` +
+ `Did you reference the function correctly?`,
+ vm
+ )
+ }
+ if (props && hasOwn(props, key)) {
+ warn(
+ `method "${key}" has already been defined as a prop.`,
+ vm
+ )
+ }
}
}
}
diff --git a/test/unit/features/options/props.spec.js b/test/unit/features/options/props.spec.js
index 95f85fffef4..81180ee5e80 100644
--- a/test/unit/features/options/props.spec.js
+++ b/test/unit/features/options/props.spec.js
@@ -306,6 +306,27 @@ describe('Options props', () => {
expect('already declared as a prop').toHaveBeenWarned()
})
+ it('should warn methods already defined as a prop', () => {
+ new Vue({
+ template: '