editor太诡异了啊啊啊啊啊啊啊啊?

发布于 6 年前作者 xiulan3613401 次浏览最后编辑 6 年前来自 ask

问题一:必须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 回复
wei56
wei561 楼6 年前
juan14
juan142 楼4 年前
问题一补充:跟console.log没关系是时而可以时而不可以