-
Notifications
You must be signed in to change notification settings - Fork 667
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
popup 在Vue3中是否无法在组合式api中使用 #895
Comments
应该是this.$refs.popupRef.open() |
@julytian 这里是因为我根据示例改成了选项式(vue2那种范式)的方式,ref就变成了popup。 |
@julytian 如果使用组合式api(setup)就会导致获取不到这个组件的示例,但是自定义的组件时可以的。 |
@Bo-Teng ,vue3 setup 写法没有 this 了,你试下下面这种写法: import { ref } from 'vue'
const popupRef = ref()
function open() {
popupRef.value?.open()
} |
@julytian 哥们谢谢你的指点,我发现了我问题是因为我没有导出这个popupRef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我尝试使用图中的方法去获取组件实例,但是在获取不到。
经过尝试只能使用选项式的方式去获取(如下图),如果暂时还不支持组合式建议在文档中说明一下,不然对像我这种刚接触uni app 还是挺迷茫的。
环境:
HBuilderX 4.15
window 10
微信开发者工具 stable 1.06.2402040
The text was updated successfully, but these errors were encountered: