1
0

site-layout.vue 685 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <script lang="ts" setup>
  2. import { nextTick, onMounted, watch } from 'vue';
  3. import mediumZoom from 'medium-zoom';
  4. import { useRoute } from 'vitepress';
  5. import DefaultTheme from 'vitepress/theme';
  6. const { Layout } = DefaultTheme;
  7. const route = useRoute();
  8. const initZoom = () => {
  9. // mediumZoom('[data-zoomable]', { background: 'var(--vp-c-bg)' });
  10. mediumZoom('.VPContent img', { background: 'var(--vp-c-bg)' });
  11. };
  12. watch(
  13. () => route.path,
  14. () => nextTick(() => initZoom()),
  15. );
  16. onMounted(() => {
  17. initZoom();
  18. });
  19. </script>
  20. <template>
  21. <Layout />
  22. </template>
  23. <style>
  24. .medium-zoom-overlay {
  25. z-index: 2147483646;
  26. }
  27. .medium-zoom-image {
  28. z-index: 2147483647;
  29. }
  30. </style>