-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
keep-alive组件的include中如果使用的是一个ref([]),并且延迟添加,会不起效,而且组件不能再次激活,绑定也会失效 #4984
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
Comments
Maybe you could consider changing setup() {
const cn = ref("tab1");
// use ref
const keeps = ref([]);
keeps.value = ["tab2"]; -------------> keeps.value = ["tab1"];
setTimeout(() => {
keeps.value.push("tab1"); // fail
// keeps.value = ["tab1", "tab2"]; //ok
}, 500); |
as a workround :include="[...keeps]"
the watch will not trigger if // prune cache on include/exclude prop change
watch(
() => [props.include, props.exclude],
([include, exclude]) => {
include && pruneCache(name => matches(include, name))
exclude && pruneCache(name => !matches(exclude, name))
},
// prune post-render after `current` has been updated
{ flush: 'post', deep: true }
) |
Seems to me like it would trigger, because of |
谢谢大家 |
@lejianwen 这应该是个 bug,还没来得及调查,后面会修复的。 |
This issue is fixed by commit. |
Version
3.2.22
Reproduction link
codesandbox.io
Steps to reproduce
点击chang按钮,到tab2 组件, 再点change回来,onActivated不会触发,并且tab1中两个input绑定的同一个ref也会断开。
使用computed也必须注意要返回Array才行。
What is expected?
按道理应该点击回来tab1的onActivated会触发,并且绑定不会断开
What is actually happening?
onActivated不会触发,并且tab1中两个input绑定的同一个ref也断开了
include暂时不支持使用ref么?
The text was updated successfully, but these errors were encountered: