refactor: 组件就近迁移、操作菜单组件化并统一页面命名

- 组件文件统一 PascalCase 并就近迁入所属目录
- 操作菜单抽为 ActionSheet 组件,危险操作确认拆为 useConfirmAction
- 导航栏测量拆为 useNavbarMetrics 并收缩对外接口
- 页面方法按动词约定重命名,show 前缀与 handle 误用一并修正
- 通知与菜单接口类型改用字面量联合并修正取值注释
- 多行空壳注释收回单行
This commit is contained in:
Ray.Hao committed 2026-10-16 16:50:56 +08:00
1 parent 1e3954ce0c
commit cb1a1e349f
63 files changed
+1653 -1423

No files matched your search

+17 -5
View File
@@ -4,16 +4,23 @@ import { Storage } from "@/utils/storage";
import { formatBytes } from "@/utils/format";
/**
* 缓存体积与清理
* 缓存体积统计与清理
*
* 只统计并清理可重建的缓存(如用户信息缓存),登录态与主题偏好不参与,
* 避免像 uni.clearStorage() 那样把 token 一起清掉导致下次启动退出登录。
* 统计与清理的范围都是「保留名单之外的全部本地键」:登录态与主题偏好保留,
* 其余键(用户信息缓存等)一并删除。
*/
export function useCacheCleaner() {
const toast = useToast();
/** 缓存体积的展示文案,未统计完成前为「计算中...」 */
const usageText = ref("计算中...");
/** 是否正在清理,用于展示遮罩并挡住重复触发 */
const isClearing = ref(false);
/**
* 统计可清理的缓存体积
*
* 读取失败时展示「获取失败」,避免把异常状态当成 0B。
*/
async function loadUsage() {
try {
usageText.value = formatBytes(Storage.getClearableBytes());
@@ -22,7 +29,12 @@ export function useCacheCleaner() {
}
}
async function clear() {
/**
* 清理缓存并刷新体积
*
* 体积获取失败或无缓存时不发起删除,成功删除后才提示清理成功。
*/
async function clearCache() {
if (usageText.value === "获取失败") {
toast.info("获取缓存信息失败,请稍后重试");
return;
@@ -51,5 +63,5 @@ export function useCacheCleaner() {
}
}
return { usageText, isClearing, loadUsage, clear };
return { usageText, isClearing, loadUsage, clearCache };
}