init
This commit is contained in:
0
xhs-mini-demos/api-case/mp-update/mp-update.css
Normal file
0
xhs-mini-demos/api-case/mp-update/mp-update.css
Normal file
21
xhs-mini-demos/api-case/mp-update/mp-update.js
Normal file
21
xhs-mini-demos/api-case/mp-update/mp-update.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const __templateJs = require("./templates.js");
|
||||
const __mergePageOptions = require("../../util/mergePageOptions.js");
|
||||
Page(__mergePageOptions({
|
||||
data: {
|
||||
shouldUpdate: ''
|
||||
},
|
||||
handleCheckUpdate(e) {
|
||||
this.setData({
|
||||
shouldUpdate: false
|
||||
});
|
||||
},
|
||||
onLoad() {
|
||||
const updateManager = xhs.getUpdateManager();
|
||||
updateManager.onCheckForUpdate(res => {
|
||||
xhs.showModal({
|
||||
title: '提示',
|
||||
content: JSON.stringify(res)
|
||||
});
|
||||
});
|
||||
}
|
||||
}, __templateJs));
|
||||
8
xhs-mini-demos/api-case/mp-update/mp-update.json
Normal file
8
xhs-mini-demos/api-case/mp-update/mp-update.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "检测小程序更新",
|
||||
"usingComponents": {
|
||||
"showbox": "../../common/component/showbox/index",
|
||||
"box": "../../common/component/container/index",
|
||||
"api-status": "../../common/component/api-status/index"
|
||||
}
|
||||
}
|
||||
11
xhs-mini-demos/api-case/mp-update/mp-update.xhsml
Normal file
11
xhs-mini-demos/api-case/mp-update/mp-update.xhsml
Normal file
@@ -0,0 +1,11 @@
|
||||
<view class="container">
|
||||
<showbox title="检测小程序是否更新">
|
||||
<box>
|
||||
<view class="_mb8">
|
||||
返回值:{{ shouldUpdate }}
|
||||
</view>
|
||||
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="handleCheckUpdate">检测小程序是否更新</button>
|
||||
</box>
|
||||
</showbox>
|
||||
</view>
|
||||
<include src="templates.xhsml" />
|
||||
46
xhs-mini-demos/api-case/mp-update/templates.js
Normal file
46
xhs-mini-demos/api-case/mp-update/templates.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/** 以下内容为自动生成,请勿手动修改 */
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
page_data_0: false,
|
||||
|
||||
page_data_1: false,
|
||||
|
||||
page_data_2: false,
|
||||
|
||||
page_data_3: "",
|
||||
},
|
||||
|
||||
page_fun_0() {
|
||||
const updateManager = xhs.getUpdateManager();
|
||||
|
||||
this.setData({
|
||||
page_data_0: false,
|
||||
page_data_1: false,
|
||||
page_data_2: false,
|
||||
});
|
||||
|
||||
updateManager.applyUpdate({
|
||||
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,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
24
xhs-mini-demos/api-case/mp-update/templates.xhsml
Normal file
24
xhs-mini-demos/api-case/mp-update/templates.xhsml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!-- 以下内容为自动生成,请勿手动修改 -->
|
||||
|
||||
<view class="container">
|
||||
<showbox title="applyUpdate演示">
|
||||
<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>
|
||||
</view>
|
||||
Reference in New Issue
Block a user