微信小程式---筆記
阿新 • • 發佈:2019-01-13
1.初始化資料將作為頁面的第一次渲染。data 將會以 JSON 的形式由邏輯層傳至渲染層,所以其資料必須是可以轉成 JSON 的格式:字串,數字,布林值,物件,陣列。
-
使用者重新整理事件使用
onPullDownRefresh:function(){ onPullDownRefresh:function(){
// 使用者重新整理事件,
var that = this;
wx.request({
// 重新整理時傳送請求
url: ‘https://api.eawsp.com/api/creditCard/getCreditCardImg’, //僅為示例,並非真實的介面地址
data: {
},
method: “POST”,
header: {
“Content-Type”: “application/x-www-form-urlencoded” //post
},
success: function (res) {
if (res.data.code == 0) {
console.log(res.data.data.data);
that.setData({
card: res.data.data.data
})
}
}
})
wx.stopPullDownRefresh();
// 結束重新整理
}