editor太诡异了啊啊啊啊啊啊啊啊?
问题一:必须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 // #the-id节点的上边界坐标
res[1].scrollTop // 显示区域的竖直滚动位置
})
2 回复