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