chore: do not warn about reserved methods

This commit is contained in:
Evan You 2018-11-03 05:40:20 +09:00
parent 3e31de3742
commit bf6e49559a

View File

@ -3,6 +3,7 @@ import { isFunction, isReservedKey } from '@vue/shared'
import { warn } from './warning' import { warn } from './warning'
import { isRendering } from './componentUtils' import { isRendering } from './componentUtils'
import { isObservable } from '@vue/observer' import { isObservable } from '@vue/observer'
import { reservedMethods } from '@vue/runtime-dom'
const bindCache = new WeakMap() const bindCache = new WeakMap()
@ -41,7 +42,12 @@ const renderProxyHandlers = {
// hooks injections // hooks injections
return i[key] return i[key]
} else if (key[0] !== '_') { } else if (key[0] !== '_') {
if (__DEV__ && isRendering && !(key in target)) { if (
__DEV__ &&
isRendering &&
!(key in target) &&
!(key in reservedMethods)
) {
warn( warn(
`property "${key}" was accessed during render but does not exist ` + `property "${key}" was accessed during render but does not exist ` +
`on instance.` `on instance.`