W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
my.startPullDownRefresh 是主動開啟下拉刷新的 API。
allowsBounceVertical
、pullRefresh
參數(shù)影響。
//.js
my.startPullDownRefresh()
Object 類型,屬性如下:
屬性 | 類型 | 必填 | 描述 |
---|---|---|---|
success | Function | 否 | 接口調(diào)用成功的回調(diào)函數(shù)。 |
fail | Function | 否 | 接口調(diào)用失敗的回調(diào)函數(shù)。 |
complete | Function | 否 | 接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會執(zhí)行)。 |
my.stopPullDownRefresh 是停止當(dāng)前頁面的下拉刷新的 API。
// API-DEMO page/API/pull-down-refresh/pull-down-refresh.json
{
"defaultTitle": "下拉刷新",
"pullRefresh": true
}
<!-- API-DEMO page/API/pull-down-refresh/pull-down-refresh.axml-->
<view class="page">
<view class="page-section">
<view class="page-section-title">下滑頁面即可刷新</view>
<view class="page-section-btns">
<view type="primary" onTap="stopPullDownRefresh">停止刷新</view>
</view>
</view>
</view>
// API-DEMO page/API/pull-down-refresh/pull-down-refresh.js
Page({
onPullDownRefresh() {
console.log('onPullDownRefresh', new Date());
},
stopPullDownRefresh() {
my.stopPullDownRefresh({
complete(res) {
console.log(res, new Date())
}
})
}
});
Object 類型,屬性如下:
屬性 | 類型 | 必填 | 描述 |
---|---|---|---|
success | Function | 否 | 接口調(diào)用成功的回調(diào)函數(shù)。 |
fail | Function | 否 | 接口調(diào)用失敗的回調(diào)函數(shù)。 |
complete | Function | 否 | 接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會執(zhí)行)。 |
onPullDownRefresh 是用于在 Page 中自定義 onPullDownRefresh 函數(shù),可以監(jiān)聽該頁面的下拉刷新事件的 API。
"allowsBounceVertical":"YES"
,在頁面對應(yīng)的 .json 配置文件中配置 "pullRefresh":true
選項,才可開啟頁面下拉刷新事件。
// API-DEMO page/API/pull-down-refresh/pull-down-refresh.json
{
"defaultTitle": "下拉刷新",
"pullRefresh": true
}
<!-- API-DEMO page/API/pull-down-refresh/pull-down-refresh.axml-->
<view class="page">
<view class="page-section">
<view class="page-section-title">下滑頁面即可刷新</view>
<view class="page-section-btns">
<view type="primary" onTap="stopPullDownRefresh">停止刷新</view>
</view>
</view>
</view>
// API-DEMO page/API/pull-down-refresh/pull-down-refresh.js
Page({
onPullDownRefresh() {
console.log('onPullDownRefresh', new Date());
},
stopPullDownRefresh() {
my.stopPullDownRefresh({
complete(res) {
console.log(res, new Date())
}
})
}
});
屬性 | 類型 | 必填 | 描述 |
---|---|---|---|
pullRefresh | Boolean | 否 | 是否允許下拉刷新。默認 true。說明:下拉刷新生效的前提是 allowsBounceVertical 值為 YES 。 |
allowsBounceVertical | String | 否 | 頁面是否支持縱向拽拉超出實際內(nèi)容。默認 YES,支持 YES /NO 。 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: