editor太诡异了啊啊啊啊啊啊啊啊?
发布于 4 年前 作者 xiulan36 13196 次浏览 来自 问答

问题一:必须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 回复
问题一补充:跟console.log没关系是时而可以时而不可以
回到顶部