dx: warn use of reserved methods in render
This commit is contained in:
parent
3754233f38
commit
93744d5889
@ -37,17 +37,19 @@ const renderProxyHandlers = {
|
||||
// computed
|
||||
return i[key]()
|
||||
} else if (key[0] !== '_') {
|
||||
if (
|
||||
__DEV__ &&
|
||||
isRendering &&
|
||||
!(key in target) &&
|
||||
!(key in reservedMethods)
|
||||
) {
|
||||
if (__DEV__ && isRendering) {
|
||||
if (key in reservedMethods) {
|
||||
warn(
|
||||
`"${key}" is a reserved method / lifecycle hook and should not be ` +
|
||||
`used as a normal method during render.`
|
||||
)
|
||||
} else if (!(key in target)) {
|
||||
warn(
|
||||
`property "${key}" was accessed during render but does not exist ` +
|
||||
`on instance.`
|
||||
)
|
||||
}
|
||||
}
|
||||
const value = Reflect.get(target, key, receiver)
|
||||
if (key !== 'constructor' && isFunction(value)) {
|
||||
// auto bind
|
||||
|
Loading…
Reference in New Issue
Block a user