CNode

wx(微信)回调里 使用 this.$http.get 提示undefined 是什么原因? (vue-resource)

问答
BBorntoGO发布于10 年前最后回复10 年前1 回复8388 浏览0 收藏

ready: function () { wx.getLocation({ type: 'wgs84', success: function (res) { this.$http.get(rul).then(function(sucess)) }

我在 ready:function() 里请求了微信定位,在定位成功的回调里发起get(vue-resource)请求 提示 Uncaught TypeError: Cannot read property 'get' of undefined , 什么原因,正确的方式应该怎么写?

查看回复

回复 (1)

B
BorntoGO#1·10 年前

知道了,外边先

let _this = this

里边用的时候使用 _this.$http 参考链接 http://www.tuicool.com/articles/7nYnIba

参与回复
登录后即可参与回复。登录