
问题一:必须console.log setContents才有效啊????为啥子呢?
onEditorReady() {
const that = this
this.createSelectorQuery().select('#editor').context(function (res) {
that.editorCtx = res.context
that.editorCtx.setContents({
html: that.data.defaultHtml,
})
}).exec()
},
问题二:官方是wx.createSelectorQuery 而我必须设置成this.createSelectorQuery()才可以获得对象why???
const query = wx.createSelectorQuery()
query.select('#the-id').boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(function(res){
res[0].top
res[1].scrollTop
})
麻烦提供能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html
问题一补充:跟console.log没关系是时而可以时而不可以