fix(reactivity): ensure readonly on plain arrays doesn't track array methods. (#2506)

fix #2493
This commit is contained in:
Thorsten Lünborg
2020-11-27 16:24:31 +01:00
committed by GitHub
parent 53f4885d9e
commit 34703082fd
2 changed files with 12 additions and 1 deletions

View File

@@ -83,7 +83,8 @@ function createGetter(isReadonly = false, shallow = false) {
}
const targetIsArray = isArray(target)
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
return Reflect.get(arrayInstrumentations, key, receiver)
}