ruki 1 hete
szülő
commit
05afa6d6c0
1 módosított fájl, 13 hozzáadás és 4 törlés
  1. 13 4
      docs/.vitepress/theme/components/WWAds.vue

+ 13 - 4
docs/.vitepress/theme/components/WWAds.vue

@@ -1,8 +1,17 @@
 <script setup lang="ts">
-import { onMounted } from 'vue'
+import { onMounted, onUnmounted } from 'vue'
 
 onMounted(() => {
+  // Check if script exists, if not append it
+  // In SPA, we might need to re-trigger script execution or use a fresh script tag
+  // to force WWAds to scan the new DOM element.
+  const existingScript = document.getElementById('wwads-script')
+  if (existingScript) {
+    existingScript.remove()
+  }
+
   const script = document.createElement('script')
+  script.id = 'wwads-script'
   script.src = 'https://cdn.wwads.cn/js/makemoney.js'
   script.async = true
   script.charset = 'UTF-8'
@@ -17,17 +26,17 @@ onMounted(() => {
 <style scoped>
 .wwads-cn {
   margin-top: 20px;
+  min-height: 150px; /* Placeholder height */
 }
 /* Mobile view adjustment */
 @media (max-width: 1280px) {
   .wwads-cn {
     width: 100% !important;
-    max-width: 350px !important; /* Limit width for better look */
+    max-width: 350px !important;
     margin: 20px auto 0;
     display: flex;
     justify-content: center;
-    background-color: transparent !important; /* Remove debug bg */
-    min-height: auto !important; /* Allow auto height */
+    min-height: auto !important;
   }
 }
 </style>