| 2819 | } |
| 2820 | |
| 2821 | function initMethods (vm, methods) { |
| 2822 | var props = vm.$options.props; |
| 2823 | for (var key in methods) { |
| 2824 | vm[key] = methods[key] == null ? noop : bind(methods[key], vm); |
| 2825 | if (process.env.NODE_ENV !== 'production') { |
| 2826 | if (methods[key] == null) { |
| 2827 | warn( |
| 2828 | "method \"" + key + "\" has an undefined value in the component definition. " + |
| 2829 | "Did you reference the function correctly?", |
| 2830 | vm |
| 2831 | ); |
| 2832 | } |
| 2833 | if (props && hasOwn(props, key)) { |
| 2834 | warn( |
| 2835 | ("method \"" + key + "\" has already been defined as a prop."), |
| 2836 | vm |
| 2837 | ); |
| 2838 | } |
| 2839 | } |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | function initWatch (vm, watch) { |
| 2844 | for (var key in watch) { |