Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

判断是否有问题 #2

Open
AwangXuan opened this issue Jul 30, 2024 · 0 comments
Open

判断是否有问题 #2

AwangXuan opened this issue Jul 30, 2024 · 0 comments

Comments

@AwangXuan
Copy link

build-your-own-vue3\packages\reactivity\src\effect.ts

if (key === "length" && isArray(target)) {
depsMap.forEach((dep, key) => {
if (key === "length" || key >= newValue) {
deps.push(dep);
}
});
switch (type) {
case TriggerOpTypes.ADD:
if (isArray(target) && isIntegerKey(key)) {
deps.push(depsMap.get("length"));
}
}
}

key === "length" && isArray(target) key 一定是字符串类型,那么forEach 里面的大于号需要判断吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant