mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-16 04:36:46 +08:00
♻️ loading组件重构
This commit is contained in:
@@ -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;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user