flat: 演示版

This commit is contained in:
Apcallover
2025-12-09 11:13:32 +08:00
parent f24d95cedf
commit 67f5dbbfb0
12 changed files with 161 additions and 36 deletions

View File

@@ -51,6 +51,23 @@ const prePage = () => {
}
export function safeReLaunch(url) {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
// 移除传入url开头的斜杠用于对比
const cleanUrl = url.startsWith('/') ? url.slice(1) : url;
if (currentPage && currentPage.route === cleanUrl) {
console.log('已在当前页');
return;
}
uni.reLaunch({
url
});
}
/**
@@ -627,7 +644,8 @@ export const $api = {
sendingMiniProgramMessage,
copyText,
aes_Decrypt,
createRequestWithCache
createRequestWithCache,
safeReLaunch
}
@@ -660,5 +678,6 @@ export default {
sm4Decrypt,
aes_Decrypt,
sm2_Decrypt,
sm2_Encrypt
sm2_Encrypt,
safeReLaunch
}