diff --git a/src/components/SocialLinks.vue b/src/components/SocialLinks.vue index cdb59d4..610d8ee 100644 --- a/src/components/SocialLinks.vue +++ b/src/components/SocialLinks.vue @@ -2,6 +2,7 @@ import { ref, computed } from "vue"; import { useMouseInElement } from "@vueuse/core"; import { useTheme } from "vuetify"; +import WechatModal from "./WechatModal.vue"; const theme = useTheme(); const cardRef = ref(null); @@ -52,7 +53,6 @@ const props = defineProps({ hoverColor: "#2DC100", ariaLabel: "扫描我的微信二维码", qrCode: new URL("./assets/wechat-qr.png", import.meta.url).href, - showQr: false, }, ], validator: (platforms) => @@ -68,16 +68,16 @@ const props = defineProps({ }); // 微信二维码显示状态管理 -const qrStates = ref({}); +const showWechatModal = ref(false); +const currentQrCode = ref(""); + const toggleQrCode = (platform) => { if (platform.qrCode) { - qrStates.value[platform.name] = !qrStates.value[platform.name]; - emit("showWechat", qrStates.value[platform.name]); + currentQrCode.value = platform.qrCode; + showWechatModal.value = !showWechatModal.value; } }; -const emit = defineEmits(["showWechat"]); - // 计算属性 const platformsWithQr = computed(() => props.socialPlatforms.filter((p) => p.qrCode) @@ -106,29 +106,14 @@ const openLink = (url) => {