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

如何获取微信原生第三方组件的实例 #7391

Closed
luxiaojie322 opened this issue Aug 20, 2020 · 7 comments
Closed

如何获取微信原生第三方组件的实例 #7391

luxiaojie322 opened this issue Aug 20, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@luxiaojie322
Copy link

这个特性解决了什么问题?

调用微信原生第三方组件实力上的方法,如图片裁剪组件的获取裁剪图片的方法

这个 API 长什么样?

微信原生的获取方式: this.cropper = this.selectComponent("#image-cropper")

@rottenpen
Copy link
Contributor

暂时用 getCurrentPages()[0] 代替 this 看行不行?

@allendongyx
Copy link

我来顶你一下,我也不行

1 similar comment
@JX-Zhuang
Copy link

我来顶你一下,我也不行

@JX-Zhuang
Copy link

暂时用 getCurrentPages()[0] 代替 this 看行不行?

不行

@allendongyx
Copy link

@JX-Zhuang
const _cropRef = getCurrentInstance().page.selectComponent(
'#image-cropper'
)

通过这种方式来获取

@Chen-jj
Copy link
Contributor

Chen-jj commented Jan 29, 2021

楼上正解,文档:https://taro-docs.jd.com/taro/docs/hybrid#selectcomponent

@Chen-jj Chen-jj closed this as completed Jan 29, 2021
@soneway
Copy link

soneway commented Sep 23, 2021

@JX-Zhuang
const _cropRef = getCurrentInstance().page.selectComponent(
'#image-cropper'
)

通过这种方式来获取

这个可以么, taro 3.3.8 取不到, 始终是null

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

No branches or pull requests

6 participants