zqhsyc
zqhsyc
  • 发布:2020-03-23 19:29
  • 更新:2020-08-10 16:57
  • 阅读:1151

【报Bug】App端 动态创建的editor 用uni.createSelectorQuery().in(this).select('#editor'+index).context()获取会报错

分类:uni-app

App端 view v-for里 动态创建的editor 用uni.createSelectorQuery().in(this).select('#editor'+index).context()获取会报错
18:40:47.690 at uniapp://ready:182:637756
18:40:47.710 at t.(anonymous function) (uniapp://ready:182:89683)
18:40:47.730 at Object.subscribeHandler (uniapp://ready:182:1513)
18:40:47.750 at Object.z [as subscribeHandler] (uniapp://ready:1:8955)
18:40:47.790 webviewScriptError
18:40:47.810 h.push is not a function
18:40:47.830 TypeError: h.push is not a function
18:40:47.850 at Object.addFetchInfo (uniapp://ready:182:636545)
18:40:47.870 at uniapp://ready:182:637756
18:40:47.890 at t.(anonymous function) (uniapp://ready:182:89683)
18:40:47.910 at Object.subscribeHandler (uniapp://ready:182:1513)
18:40:47.930 at Object.z [as subscribeHandler] (uniapp://ready:1:8955)
18:40:47.970 Uncaught TypeError: h.push is not a function at uniapp://ready:182

(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)

[内容]

重现步骤

[步骤]
1 veiw里动态创建editor 刚开始里面有1个editor
<view class="content-list" v-for="(item, index) in contentList" :key="index" @tap.stop>
<editor :id="'editor'+index" v-if="item.type === 'editor'
@ready="onEditorReady(index)">
</editor>
<view :id="'editor'+index" v-if="item.type === 'video'">
<image class="video" :src="item.cover" mode="widthFix"/>
</view>
</view>
2 第一个editor里插入一个图片
3 contentList 动态插入一个 item.type为video的 然后在插入一个item.type为 editor
4 此时会动态创建一个editor 在onEditorReady(index)里 用uni.createSelectorQuery().in(this).select('#editor'+index).context()
获取editro的context 就会下面错误
18:40:47.690 at uniapp://ready:182:637756
18:40:47.710 at t.(anonymous function) (uniapp://ready:182:89683)
18:40:47.730 at Object.subscribeHandler (uniapp://ready:182:1513)
18:40:47.750 at Object.z [as subscribeHandler] (uniapp://ready:1:8955)
18:40:47.790 webviewScriptError
18:40:47.810 h.push is not a function
18:40:47.830 TypeError: h.push is not a function
18:40:47.850 at Object.addFetchInfo (uniapp://ready:182:636545)
18:40:47.870 at uniapp://ready:182:637756
18:40:47.890 at t.(anonymous function) (uniapp://ready:182:89683)
18:40:47.910 at Object.subscribeHandler (uniapp://ready:182:1513)
18:40:47.930 at Object.z [as subscribeHandler] (uniapp://ready:1:8955)
18:40:47.970 Uncaught TypeError: h.push is not a function at uniapp://ready:182

[期望] 正确获取到动态创建的editor的context

[QQ]1592863142

2020-03-23 19:29 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

在 onReady/mounted 生命周期获取

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