萌新求问wx.request中写localhost遇到的问题
requrest: function () {
wx.request({
url: 'http://localhost:8080/1.php',
method: 'POST',
success: function (res) {
console.log(res.data);
},
fail: function (res) {
console.log('submit fail');
},
complete: function (res) {
console.log('submit complete');
}
})
},
用一个简单项目试一下request这个api,在网上查看了好多资料,可以用localhost ,我本地的数据库有的是wamp mysql 。
在url中如上写到,但是一直出现下面的问题:
console中出现下面的问题:
Do not have request handler in current page: pages/index/index. Please make sure that request handler has been defined in pages/index/index, or pages/index/index has been added into app.json
求问是怎么回事,环境配置的问题还是url写的不对