初始代码

This commit is contained in:
wangmingwei
2026-04-21 16:55:00 +08:00
parent be9f1657b9
commit 35101db700
1335 changed files with 211213 additions and 0 deletions

21
utils/refreshCurrent.js Normal file
View File

@@ -0,0 +1,21 @@
// 将对象序列化为查询字符串
function stringifyQuery(obj) {
let ret = [];
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
ret.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));
}
}
return ret.join('&');
}
export function refreshCurrentPage() {
// 获取当前页面的路径
let currentPage = getCurrentPages().pop();
if (currentPage) {
// 重启当前页面
uni.reLaunch({
url: `/${currentPage.route}` + (currentPage.options ? `?${stringifyQuery(currentPage.options)}` :
'')
});
}
}