收藏
回答

微信小程序测试号无法连接到本地服务器,怎么办?

求大佬指点。


微信开发工具index.js 里的代码

  onLoad:function(){

    var that = this

    wx.request({

      url: 'http://127.0.0.1:1080',

      success:function(res){

        console.log(res)

        that.setData(res.data)

      }

    })

  },


  submit: function(e){

    wx.request({

      method: 'post',

      url: 'http://127.0.0.1:1080',

      data: e.detail.value,

      success: function(res) {

        console.log(res)

      }

    })

  }

})

本地服务器index.js 里的代码

app.listen(1080, () => {

console.log('server running at http://127.0.0.1:1080')

})

错误:

VM456:1 工具未校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书。

VM460 asdebug.js:1 GET http://127.0.0.1:1080/ net::ERR_CONNECTION_REFUSED

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容
问题标签