♻️ loading组件重构

This commit is contained in:
目棃
2024-12-16 11:13:30 +08:00
parent 1f167845a4
commit 24e3f11c4a
33 changed files with 482 additions and 428 deletions

View File

@@ -19,14 +19,16 @@ const showToli = ref<boolean>(false);
watch(
() => props.modelValue,
() => {
async () => {
if (props.modelValue) {
showTolo.value = true;
showToli.value = true;
return;
}
setTimeout(() => (showToli.value = false), 100);
setTimeout(() => (showTolo.value = false), 300);
await new Promise<void>((resolve) => setTimeout(resolve, 100));
showToli.value = false;
await new Promise<void>((resolve) => setTimeout(resolve, 300));
showTolo.value = false;
},
);

View File

@@ -16,12 +16,12 @@ type TShareBtnProps = { selector: string; title: string };
const props = defineProps<TShareBtnProps>();
async function shareContent(): Promise<void> {
showLoading.start("正在生成分享图片", props.title);
await showLoading.start("正在生成分享图片", props.title);
await TGLogger.Info("[TShareBtn][shareContent] 开始生成分享图片");
const shareDom = document.querySelector<HTMLElement>(props.selector);
if (shareDom === null) {
showSnackbar.error("分享内容不存在", 3000);
showLoading.end();
await showLoading.end();
return;
}
shareDom.querySelectorAll("details").forEach((item) => {
@@ -33,7 +33,7 @@ async function shareContent(): Promise<void> {
if (item.hasAttribute("details-open")) item.removeAttribute("details-open");
else item.open = false;
});
showLoading.end();
await showLoading.end();
await TGLogger.Info("[TShareBtn][shareContent] 生成分享图片完成");
}
</script>