收藏
回答

that.setdata is not a function报错?求解决

MiniProgramError
that.setdata is not a function
TypeError: that.setdata is not a function
    at success (http://127.0.0.1:24079/appservice/pages/duanzi/duanzi.js:32:14)
    at Function.i. (http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:1794394)
    at function>
    at http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:121691
    at k (http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:600639)
    at Function. (http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:804142)
    at function>
    at http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:121691
    at http://127.0.0.1:24079/appservice/__dev__/WAService.js:2:783472
    at Set.forEach ()
————————————————————————————————
该部分js对应为:
Page({
  onLoad: function onLoad() {
    var _this2 = this;


    console.log('onLoad');
    wx.request({
      url: 'https://bb.yqchh.com/api/index.php',
      //仅为示例,并非真实的接口地址
      data: {
        a: ''
      },
      header: {
        'content-type': 'application/json' // 默认值


      },
      success: function success(res) {
        console.log(res.data);


        _this2.setData({
          a: res.data
        });
      }
    });
    var that = this;
    wx.request({
      url: 'https://bb.yqchh.com/api/index.php',
      success: function success(res) {
        that.setdata({
          a: res.data
        });
      }
    });
  }
});
wx.showShareMenu({
  withShareTicket: true,
  menus: ['shareAppMessage', 'shareTimeline'],
  success: function success(res) {
    console.log('showShareMenu', res);
  },
  onShareTimeline: function onShareTimeline() {
    var _this = this;


    return {
      title: "页面标题",
      query: "页面路径"
    };
  }
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBhZ2VzL2R1YW56aS9kdWFuemkuanMiXSwibmFtZXMiOlsiUGFnZSIsIm9uTG9hZCIsImNvbnNvbGUiLCJsb2ciLCJ3eCIsInJlcXVlc3QiLCJ1cmwiLCJkYXRhIiwiYSIsImhlYWRlciIsInN1Y2Nlc3MiLCJyZXMiLCJzZXREYXRhIiwidGhhdCIsInNldGRhdGEiLCJzaG93U2hhcmVNZW51Iiwid2l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cbiAgICAgICAgICB9KVxuICAgICAgICAgIFxuICAgICAgfVxuICAgICAgXG4gICAgfSlcbiAgICB2YXIgdGhhdD10aGlzO1xuICAgIHd4LnJlcXVlc3Qoe1xuICAgICAgdXJsOidodHRwczovL2IueXFjaGguY29tL2FwaS9pbmRleC5waHAnLFxuICAgICAgc3VjY2VzczpyZXM9PntcbiAgICAgIHRoYXQuc2V0ZGF0YSAoe1xuICAgICAgICBhOnJlcy5kYXRhXG4gICAgICB9KVxuICAgICAgfVxuICBcbiAgICAgIFxuICAgIH0pXG4gICB9LFxuICBcbiAgXG4gIFxuICBcbiAgXG4gIFxuICBcbiAgXG4gIFxuICBcbiAgXG4gIFxuICBcbiAgIFxuICB9KVxuICB3eC5zaG93U2hhcmVNZW51KHtcbiAgICB3aXRoU2hhcmVUaWNrZXQ6IHRydWUsXG4gICAgbWVudXM6IFsnc2hhcmVBcHBNZXNzYWdlJywgJ3NoYXJlVGltZWxpbmUnXSxcbiAgICBzdWNjZXNzKHJlcykge1xuICAgICAgY29uc29sZS5sb2coJ3Nob3dTaGFyZU1lbnUnLHJlcyk7XG4gICAgfSxcbiAgICBvblNoYXJlVGltZWxpbmUoKSB7XG4gICAgICBsZXQgX3RoaXMgPSB0aGlzO1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgdGl0bGU6XCLpobXpnaLmoIfpophcIixcbiAgICAgICAgcXVlcnk6IFwi6aG16Z2i6Lev5b6EXCJcbiAgICAgIH07XG4gICAgfSxcbiAgfSk7Il19
});


___________

谢谢好心人。
回答关注问题邀请回答
收藏

7 个回答

  • 拾忆
    拾忆
    2020-08-27

    this.setData 大小写

    2020-08-27
    有用 1
    回复
  • 贩卖焦虑
    贩卖焦虑
    2020-08-27

    大写的D

    2020-08-27
    有用 1
    回复
  • 神不在的星期天
    神不在的星期天
    2020-08-27

    大写D

    2020-08-27
    有用 1
    回复
  • จุ๊บ
    จุ๊บ
    2020-08-27

    setData 并非 setdata

    2020-08-27
    有用 1
    回复
  • Mr.Zhao
    Mr.Zhao
    2020-08-27

    setData setdata? 恍恍惚惚?

    2020-08-27
    有用 1
    回复 1
    • 汪洋
      汪洋
      2020-08-27
      哈哈哈,setData完美已解决
      2020-08-27
      回复
  • xy
    xy
    2020-09-11

    setData

    2020-09-11
    有用 1
    回复
  • 汪洋
    汪洋
    2020-08-27

    此贴永久保留,纪念这个不可忽略的细节错误

    2020-08-27
    有用
    回复
登录 后发表内容
问题标签