Skip to content

fix(vc-image): remove repeat listener #6945

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

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Conversation

kovsu
Copy link
Member

@kovsu kovsu commented Sep 12, 2023

close: #6944

const [isShowPreview, setShowPreview] = useMergedState(!!previewVisible.value, {
  value: previewVisible,
  onChange: onPreviewVisibleChange,
});

- watch(isShowPreview, (val, preVal) => {
-  onPreviewVisibleChange(val, preVal);
- });

useMergedState 这个方法里面传递了 onChange 属性,所以就没有必要再监听 isShowPreview 的变化了

@rayadaschn
Copy link

嗨~ 您好!请问一下,useMergedState 这个方法是 react 里的 useMergedState hooks 嘛?

1 similar comment
@rayadaschn
Copy link

嗨~ 您好!请问一下,useMergedState 这个方法是 react 里的 useMergedState hooks 嘛?

@kovsu
Copy link
Member Author

kovsu commented Sep 12, 2023

@rayadaschn 应该是,你可以看一下。在 components/_util/hooks/useMergedState.ts 目录。[狗头]

@tangjinzhou tangjinzhou merged commit 3c5fb84 into vueComponent:main Sep 15, 2023
@kovsu kovsu deleted the fix-#6944 branch September 15, 2023 06:26
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

组件 Image 预览onVisibleChange事件重复执行
3 participants