监听dom的ref失效 #9015
Answered
by
liulinboyi
fishcy
asked this question in
Help/Questions
监听dom的ref失效
#9015
-
请问为什么使用ref获取dom节点后,用watch监听ref不生效 |
Beta Was this translation helpful? Give feedback.
Answered by
liulinboyi
Aug 21, 2023
Replies: 1 comment 3 replies
-
Tips: You can use like this: PlayFround |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
watch
only can trigger the callback, when in thegetter
's reactive value is changed. The DOM changewatch
can't trigger the callback.I think you should get the DOM and then use the follow Browser API:https://developer.mozilla.org/zh-CN/docs/Web/API/ResizeObserver
https://developer.mozilla.org/zh-CN/docs/Web/API/MutationOb…