如果使用 uni.createSelectorQuery( )返回 null 则需要在后面加上 .in(this)。
但是在 vue3 中这样做是会报错的
则需要使用 getCurrentInstance() 方法获取实例
将 this 换成 instance ,即 uni.createSelectQuery().in(instance)
就能获取到元素数据!
如果使用 uni.createSelectorQuery( )返回 null 则需要在后面加上 .in(this)。
但是在 vue3 中这样做是会报错的
则需要使用 getCurrentInstance() 方法获取实例
将 this 换成 instance ,即 uni.createSelectQuery().in(instance)
就能获取到元素数据!