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

第四十二题:React 获取 ref 的方法都有哪些? #42

Open
Ray-56 opened this issue Oct 14, 2019 · 1 comment
Open

第四十二题:React 获取 ref 的方法都有哪些? #42

Ray-56 opened this issue Oct 14, 2019 · 1 comment
Labels
React 前端框架

Comments

@Ray-56
Copy link
Owner

Ray-56 commented Oct 14, 2019

React 获取 ref 的方法都有哪些?

@Ray-56 Ray-56 added the React 前端框架 label Oct 14, 2019
@MMmaXingXing
Copy link

具体实现

this.$ref.title //可以用于获取dom节点元素(对于html元素使用ref的情况,ref本身引用的就是该元素的实际dom节点)

ReactDOM.findDOMNdoe(ref) // 可以获取挂载后的真正dom节点

以上,共两种

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

No branches or pull requests

2 participants