1、微信小程序錯誤狀態碼(例如:401)的獲取
當小程序請求后端接口時,可能返回狀態碼:
200(請求成功) ...
在wx.request()的fail: function(data) 中 獲取不到 success: function(data) { console.log(data.statusCode) } fail回調一般源于在url格式、參數類型檢查、網絡連接、域名解析、response編碼問題等
2、日期選擇器的起始時間極限值
<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> 小程序的日期選擇器,關鍵問題在于start(起始時間),該值有個極限值。 模擬器上沒有極限值,但是在手機上顯示的話,如果早于該極限值的話,則顯示的是上一次設置有效的起始值,如果沒有設置的話,則是end的前3年作為起始值。 不知道是自己的操作有問題還是設置有問題,偏偏讓我遇到了這個問題。本來在模擬器上一切正常,結果到了手機上起始時間錯了,然后百度搜索,結果搜到的一堆都是類似小程序組件picker的教程,毫無用處,難道只有我遇到嗎,我真不信,或許這是小程序手機適配的BUG嗎。為了用戶體驗,只能嘗試去找出這個極限值,目前找到的是1971年。 測試手機:紅米3
3、通過微信小程序平臺提供的接口 訪問日活數據 date format錯誤?
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" } 這是一個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> 代碼如上,當點擊.list-item時并沒有觸發bindtap事件,而是觸發了catchtouchstart,catchtouchend
把catchtouchstart,catchtouchend事件移除后,能正常捕捉bindtap
請問有什么好的方法解決,catchtouchstart,catchtouchend事件不能移除,另有他用。 答:
tap,touchstart,touchend的事件觸發順序為start→end→tap |