在组件中调用wx.createSelectorQuery().为null
发布于 6 年前 作者 xiulan55 11120 次浏览 来自 问答

    onEditorReady() {

      const  that = this;

      wx.createSelectorQuery().select(’#editor’).context(function (res) {

        that.editorCtx = res.context;

        res.context.setContents({

          html: that.data.value

        })

      }).exec()

    },

    imageOnLoad: function(e) {

      var that = this;

      wx.createSelectorQuery().in(this).select(".classTaskDetail").boundingClientRect(function(e) {

        if (e) {

          that.setData({

            height: e.height.toFixed(0)

          });

        }

      }).exec();

    },

请问下怎么才能正确获取,

3 回复

这样写可以的呀

wx 换成 this

回到顶部