1、微信小程序錯(cuò)誤狀態(tài)碼(例如:401)的獲取
當(dāng)小程序請(qǐng)求后端接口時(shí),可能返回狀態(tài)碼:
200(請(qǐng)求成功) ...
在wx.request()的fail: function(data) 中 獲取不到 success: function(data) { console.log(data.statusCode) } fail回調(diào)一般源于在url格式、參數(shù)類(lèi)型檢查、網(wǎng)絡(luò)連接、域名解析、response編碼問(wèn)題等
2、日期選擇器的起始時(shí)間極限值
<picker class="information-item-text information-item-right information-item-picker" mode="date" value="{{birthday}}" start="1971-01-01" end="2017-12-31" bindchange="bindDateChange" disabled="{{!editable}}"> </picker> 小程序的日期選擇器,關(guān)鍵問(wèn)題在于start(起始時(shí)間),該值有個(gè)極限值。 模擬器上沒(méi)有極限值,但是在手機(jī)上顯示的話(huà),如果早于該極限值的話(huà),則顯示的是上一次設(shè)置有效的起始值,如果沒(méi)有設(shè)置的話(huà),則是end的前3年作為起始值。 不知道是自己的操作有問(wèn)題還是設(shè)置有問(wèn)題,偏偏讓我遇到了這個(gè)問(wèn)題。本來(lái)在模擬器上一切正常,結(jié)果到了手機(jī)上起始時(shí)間錯(cuò)了,然后百度搜索,結(jié)果搜到的一堆都是類(lèi)似小程序組件picker的教程,毫無(wú)用處,難道只有我遇到嗎,我真不信,或許這是小程序手機(jī)適配的BUG嗎。為了用戶(hù)體驗(yàn),只能?chē)L試去找出這個(gè)極限值,目前找到的是1971年。 測(cè)試手機(jī):紅米3
3、通過(guò)微信小程序平臺(tái)提供的接口 訪(fǎng)問(wèn)日活數(shù)據(jù) date format錯(cuò)誤?
https://api.weixin.qq.com/dat...
{ CloseableHttpClient httpClient = createSSLClientDefault(); HttpPost httpPost = new HttpPost(); httpPost.setURI(new URI(url)); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); CloseableHttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); if (entity != null) { String result = EntityUtils.toString(entity, "UTF-8"); System.out.println("Response content: " + result); return result; }
Response content: {"errcode":61500,"errmsg":"date format error hint: [Dy5YZa0787e541]"} 答:你看, { "begin_date" : "20170313", "end_date" : "20170313" } 這是一個(gè)json的傳參格式,而你用的卻是urlencoded方式 httpPost.setEntity(new StringEntity(params.toString(), "UTF-8"));
4、bindtap事件與bindtouchstart和bindtouchend事件沖突 <view class="container" catchtouchstart="handleTouchStart" catchtouchend="handleTouchEnd"> <scroll-view scroll-y class="wrapper"> <view class="list-item" wx:for="{{list}}" wx:key="{{item.id}}" data-id="{{item.id}}" catchtap="handletap"> <image class="image" src="{{item.img}}"></image> <view class="right"> <text class="title">{{item.title}}</text> <text class="intro">{{item.intro}}</text> <text class="time">{{item.time.date}}</text> </view> </view> </scroll-view> </view> 代碼如上,當(dāng)點(diǎn)擊.list-item時(shí)并沒(méi)有觸發(fā)bindtap事件,而是觸發(fā)了catchtouchstart,catchtouchend
把catchtouchstart,catchtouchend事件移除后,能正常捕捉bindtap
請(qǐng)問(wèn)有什么好的方法解決,catchtouchstart,catchtouchend事件不能移除,另有他用。 答:
tap,touchstart,touchend的事件觸發(fā)順序?yàn)閟tart→end→tap |