文章内容

2017/11/13 15:23:48,作 者: 黄兵

微信小程序 不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html

微信小程序  不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html

友情提示:

大家在开发的时候,可以使用我的网站地址进行测试 

配置 request 合法域名  https://liaolongjun.duapp.com

request 可以拷贝下面的,不用做任何修改

wx.request({
url: 'https://liaolongjun.duapp.com/ace/https.do',
data: {cur:1},
method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
// header: {}, // 设置请求的 header
success: function(json){
wx.showModal({
title: '提示',
content: JSON.stringify(json.data),
success: function(res) {
if (res.confirm) {
console.log('用户点击确定')
}
}
})
}
})

1、添加合法域名,如图(必须是https

 2、开发者工具- 项目- 配置信息 - 刷新

3、开发者工具-清缓存、编译

再进行 wx.request 就OK了

分享到:

发表评论

评论列表