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,24 @@
.page-section {
margin-top: 100px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
padding: 0 25px;
box-sizing: border-box;
}
.page-body-title {
font-size: 30px;
line-height: 100px;
}
.page-body-text {
color: #bbb;
font-size: 14px;
line-height: 20px;
margin: 0 0 50px 0;
text-align: center;
}
.page-body-button {
width: 100%;
}

View File

@@ -0,0 +1,42 @@
Page({
onShareAppMessage() {
return {
title: 'memory-warn',
path: 'package/API/pages/memory-warn/memory-warn',
};
},
data: {
value: '',
memory: [],
},
resetValue() {
this.setData({ value: '' });
},
bindSubscribe() {
this.resetValue();
xhs.onMemoryWarning(e => {
this.setData({ value: JSON.stringify(e) });
});
this.setData({ value: '订阅成功' });
},
bindUnSubscribe() {
this.resetValue();
xhs.offMemoryWarning(() => {
this.setData({ value: '取消成功' });
});
},
bindMemory() {
if (this.handle) {
clearInterval(this.handle);
} else {
this.handle = setInterval(() => {
const { memory } = this.data;
for (let i = 0; i < 100; i++) {
memory.push({ name: 'test', age: 20 });
}
this.setData({ memory });
}, 1000);
}
},
});

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "memory-warn",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index"
}
}

View File

@@ -0,0 +1,13 @@
<view class="container">
<showbox title="默认">
<box>
<view>
<text>响应:{{value}}</text>
<text>数组长度:{{memory.length}}</text>
<button bindtap="bindSubscribe">订阅内存告警</button>
<button bindtap="bindUnSubscribe">取消订阅</button>
<button bindtap="bindMemory">点击按钮,消耗内存</button>
</view>
</box>
</showbox>
</view>