推荐阅读文档:
Vue3组合式API之getCurrentInstance详解 - 且行且思 - 博客园Vue2中,可以通过this来获取当前组件实例; Vue3中,在setup中无法通过this获取组件实例,console.log(this)打印出来的值是undefined。 在Vue3中,getCurrentInstance()可以用来获取当前组件实例 vue3官方文档解释 let { proxyhttps://www.cnblogs.com/Fooo/p/18024418
vue3中getCurrentInstance不推荐使用以及在<script setup>中获取全局内容(三种方式)_vue3 getcurrentinstance不推荐-CSDN博客文章浏览阅读1.8w次,点赞29次,收藏41次。文章介绍了在Vue3中,由于生命周期和设计原则的变化,不推荐使用`this`获取全局方法。推荐使用Provide/Inject机制来提供和注入全局变量,同时解释了CompositionAPI的解耦思想。还提到了使用`getCurrentInstance`的风险和替代方案。https://blog.csdn.net/m0_51223745/article/details/133993048uni.createSelectorQuery() | uni-app官网uni-app,uniCloud,serverless,uni.createSelectorQuery(),createSelectorQuery 兼容性,SelectorQuery,selectorQuery.in(component),selectorQuery.select(selector)
https://uniapp.dcloud.net.cn/api/ui/nodes-info.html#createselectorquery