🎨 现在 post 跟 anno 也能等 share 了,虽然实现丑了点x

This commit is contained in:
BTMuli
2023-06-30 22:11:38 +08:00
parent 830e590d91
commit 970c3fcd48

View File

@@ -1,4 +1,5 @@
<template>
<ToLoading v-model="loading" title="正在生成分享图片" :subtitle="`${props.title}.png`" />
<div class="share-box">
<div class="share-btn" @click="shareContent()">
<v-icon style="color: var(--theme-switch-icon)"> mdi-share-variant </v-icon>
@@ -6,9 +7,15 @@
</div>
</template>
<script lang="ts" setup>
// vue
import { ref, onMounted } from "vue";
import ToLoading from "../overlay/to-loading.vue";
// utils
import { generateShareImg } from "../../utils/TGShare";
// loading
const loading = ref<boolean>();
interface TShareBtnProps {
modelValue: HTMLElement;
title: string;
@@ -16,8 +23,12 @@ interface TShareBtnProps {
const props = defineProps<TShareBtnProps>();
onMounted(() => (loading.value = false));
async function shareContent() {
loading.value = true;
await generateShareImg(props.title, props.modelValue);
loading.value = false;
}
</script>
<style lang="css" scoped>