This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
.page-body-info {
background-color: transparent;
}
.btn-area{
margin-top: 150px;
}

View File

@@ -0,0 +1,66 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '下拉刷新',
path: 'api-case/pull-down-refresh/pull-down-refresh'
};
},
data: {
apiData: {
content: '',
success: false,
fail: false,
complete: false
}
},
resetApiData() {
this.setData({
apiData: {
success: false,
fail: false,
complete: false,
content: ''
}
});
},
updateApiData(type, content) {
const apiData = {
...this.data.apiData
};
apiData[type] = true;
apiData.content = JSON.stringify(content);
this.setData({
apiData
});
},
startPullDownRefresh() {
this.resetApiData();
xhs.startPullDownRefresh({
success: res => {
this.updateApiData('success', res);
},
fail: res => {
this.updateApiData('fail', res);
},
complete: res => {
this.updateApiData('complete', res);
}
});
},
stopPullDownRefresh() {
this.resetApiData();
xhs.stopPullDownRefresh({
success: res => {
this.updateApiData('success', res);
},
fail: res => {
this.updateApiData('fail', res);
},
complete: res => {
this.updateApiData('complete', res);
}
});
}
}, __templateJs));

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "下拉刷新",
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,12 @@
<view class="container">
<showbox title="下拉刷新">
<box>
<view class="_ui-space">
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="startPullDownRefresh">点击下拉</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="stopPullDownRefresh">停止刷新</button>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,83 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: false,
page_data_1: false,
page_data_2: false,
page_data_3: "",
page_data_4: false,
page_data_5: false,
page_data_6: false,
page_data_7: "",
},
page_fun_0() {
this.setData({
page_data_0: false,
page_data_1: false,
page_data_2: false,
});
xhs.startPullDownRefresh({
success: (res) => {
console.log("success", res);
this.setData({
page_data_0: true,
page_data_3: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_1: true,
page_data_3: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_2: true,
});
},
});
},
page_fun_1() {
this.setData({
page_data_4: false,
page_data_5: false,
page_data_6: false,
});
xhs.stopPullDownRefresh({
success: (res) => {
console.log("success", res);
this.setData({
page_data_4: true,
page_data_7: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_5: true,
page_data_7: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_6: true,
});
},
});
},
};

View File

@@ -0,0 +1,45 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="startPullDownRefresh演示">
<box>
<api-status
success="{{page_data_0}}"
complete="{{page_data_2}}"
fail="{{page_data_1}}"
text="{{page_data_3}}"
>
</api-status>
<view class="_ui-space _mt8">
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
<showbox title="stopPullDownRefresh演示">
<box>
<api-status
success="{{page_data_4}}"
complete="{{page_data_6}}"
fail="{{page_data_5}}"
text="{{page_data_7}}"
>
</api-status>
<view class="_ui-space _mt8">
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_1"
>
触发
</button>
</view>
</box>
</showbox>
</view>