在组件中调用wx.createSelectorQuery().为null

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

    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 回复
yongjin
yongjin1 楼6 年前

这样写可以的呀

luoming
luoming2 楼6 年前

wx 换成 this

omao
omao3 楼5 年前