o***@126.com
o***@126.com
  • 发布:2020-05-05 00:36
  • 更新:2020-09-11 11:32
  • 阅读:4073

uniapp获取元素createSelectorQuery报错问题

分类:uni-app
复制代码let dragBox = uni.createSelectorQuery().select('.dragBox')  
dragBox.boundingClientRect(function(pos) {  
}).exec()

各位大佬 这个在app端会报错 是版本问题吗?在安卓机会报错,苹果机ok

报错信息是:

复制代码ReferenceError: getApp is not defined at view.umd.min.js:6  
TypeError: Object [object HTMLElement] has no method 'matches' at view.umd.min.js:6

加了in(this)或者添加定时器也不行

2020-05-05 00:36 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

HBuilderX版本多少?是在什么时机获取的?能否提供一个测试工程

  • 嗨哆嚒

    最新版本,小米6X

    2020-09-11 11:41

1***@qq.com

1***@qq.com

https://ext.dcloud.net.cn/plugin?id=451
这个插件
2.6.16.20200424

1***@qq.com

1***@qq.com

小米9pro 2.7.5 20200519 测试机报错

嗨哆嚒

嗨哆嚒 - 嗨哆嚒

小米6x也报错,版本为最新版。代码和报错如下:

复制代码                //#ifdef APP-PLUS  
                query = uni.createSelectorQuery().in($this).select('.uni-video-progress-buffered');  
                console.log(query)  
                //#endif

Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

该问题目前已经被锁定, 无法添加新回复

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容