FEAT => 本次更新项目为:

更新模块完成
This commit is contained in:
超级老白兔
2025-08-05 11:59:18 +08:00
parent 192c8c3c0a
commit 57a32e252d
17 changed files with 646 additions and 190 deletions

View File

@@ -44,25 +44,6 @@
this.iframeUrl = queryString ? `${this.baseUrl}?${queryString}` : this.baseUrl;
},
// 发送消息到 iframe通过URL传参
async sendMessageToIframe() {
const paddingTop = await getTopSafeAreaHeightAsync();
this.messageId++;
const message = {
type: TYPE_EMUE.DATA, // 数据类型0数据交互 1App功能调用
data: {
id: this.messageId,
content: `Hello我是 App 发送的消息 ${this.messageId}`,
timestamp: Date.now(),
paddingTop: paddingTop
}
};
// 将消息添加到URL参数中
this.urlParams.message = encodeURIComponent(JSON.stringify(message));
this.buildIframeUrl();
console.log('[App]SendMessage=>\n' + JSON.stringify(message));
},
// 发送消息到 iframe通过URL传参
async sendBaseConfig() {
const message = {
type: TYPE_EMUE.CONFIG,
@@ -71,6 +52,7 @@
appId: '1234567890',
appName: '存客宝',
appVersion: '1.0.0',
isAppMode:true
}
};
@@ -91,9 +73,26 @@
break;
case TYPE_EMUE.FUNCTION:
console.log('[App]ReceiveMessage=>\n' + JSON.stringify(ResDetail.data));
if (ResDetail.data.action === 'clearCache') {
this.clearCache();
}
break;
}
},
clearCache() {
// 清除 webview 缓存
if (this.$refs.webviewRef) {
// 重新加载 webview
this.$refs.webviewRef.reload();
}
// 清除 webview 缓存数据
uni.clearStorage({
success: () => {
console.log('Webview 缓存已清除');
}
});
}
}
}