- wx.request 获取openid时 net::ERR_NAME_NOT_RESOLVED ?
客户端代码: wx.login({ success (res) { if (res.code) { //console.log(res.code) //发起网络请求 wx.request({ url: 'http://www.服务器域名:8080/user/getopenid', header: { 'content-type': 'application/x-www-form-urlencoded' // 默认值 }, method:"POST", data: { code: res.code }, success(res){ //解析用户信息 var my = getUserInfoByHtml(res.data.replaceAll(""","\"").replaceAll("'","\'")) console.log(my) my = JSON.parse(my.replaceAll(" ","")) my.place = my.place.replaceAll("\'","").replaceAll("[","").replaceAll("]","") if(my.power != 0){ that.UpdateShowList(my) } wx.setStorage({ key:'myinfo', data:my }) that.setData({ bannerData:that.data.bannerData, myInfo : my }) }, fail(res){ console.log(res) } }) } else { console.log('登录失败!' + res.errMsg) } } }) 在接口测试过程结果已经获取 [图片] 报错情况 [图片]
2022-04-07 - 为什么自定义弹窗组件无法多次调用?
<view class="liftarray"> <showcardpop id="liftpop" class="cardpop"></showcardpop> <view class="liftcardbox"> <view class="liftcard"><image id="Moon" bindtap="ShowCardPop" class="liftcardimg" src="{{Url_image_moon}}"></image></view> <view class="liftcard"><image id="Mercury" bindtap="ShowCardPop" class="liftcardimg" src="{{Url_image_mercury}}"></image></view> <view class="liftcard"><image id="Venus" bindtap="ShowCardPop" class="liftcardimg" src="{{Url_image_venus}}"></image></view> </view> </view> 点击图片触发自定义的弹窗组件,但是在运行后发现第一次点击成功触发,关闭弹窗后无法再次触发 ShowCardPop:function (e){ //console.log(e.currentTarget.id) this.ShowCardPop = this.selectComponent("#liftpop") this.ShowCardPop.setPop(e.currentTarget.id+":"+this.data.MyArray[e.currentTarget.id],"xxx") this.ShowCardPop.showPopup() }, 报错为: Component "pages/home/home" does not have a method "ShowCardPop" to handle event "tap".
2021-12-28