wx.getLocalIPAddress, 真机调试IP为0.0.0.0,能否获取正确IP?
https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html wx.getLocalIPAddress,PC端连wifi或者连手机热点,获取的localip类似192.168.1.6。 手机真机调试,使用自带移动网络,localip为0.0.0.0,希望获取与上述类似IP,请问能否解决? PC和安卓真机基础库:3.5.6 getIp: function () {
const that = this;
// 获取临时登录凭证
wx.login({
success: (resLogin) => {
if (resLogin.code) {
// 获取IP
wx.getLocalIPAddress({
success: (resIp) => {
console.log('resIp', resIp)
that.setData({
ip: resIp.localip, // 此处获取IP
userCode: resLogin.code
})
}
})
}
},
})
},