mirror of
				https://github.com/imezx/Warp.git
				synced 2025-10-31 02:09:18 +00:00 
			
		
		
		
	
		
			
	
	
		
			47 lines
		
	
	
	
		
			1,013 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
		
		
			
		
	
	
			47 lines
		
	
	
	
		
			1,013 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
|  | <script setup lang="ts"> | ||
|  | import type { DefaultTheme } from 'vitepress/theme' | ||
|  | import { withBase } from 'vitepress' | ||
|  | 
 | ||
|  | defineProps<{ | ||
|  |   image: DefaultTheme.ThemeableImage | ||
|  |   alt?: string | ||
|  | }>() | ||
|  | 
 | ||
|  | defineOptions({ inheritAttrs: false }) | ||
|  | </script> | ||
|  | 
 | ||
|  | <template> | ||
|  |   <template v-if="image"> | ||
|  |     <img | ||
|  |       v-if="typeof image === 'string' || 'src' in image" | ||
|  |       class="VPImage" | ||
|  |       v-bind="typeof image === 'string' ? $attrs : { ...image, ...$attrs }" | ||
|  |       :src="withBase(typeof image === 'string' ? image : image.src)" | ||
|  |       :alt="alt ?? (typeof image === 'string' ? '' : image.alt || '')" | ||
|  |     /> | ||
|  |     <template v-else> | ||
|  |       <VPImage | ||
|  |         class="dark" | ||
|  |         :image="image.dark" | ||
|  |         :alt="image.alt" | ||
|  |         v-bind="$attrs" | ||
|  |       /> | ||
|  |       <VPImage | ||
|  |         class="light" | ||
|  |         :image="image.light" | ||
|  |         :alt="image.alt" | ||
|  |         v-bind="$attrs" | ||
|  |       /> | ||
|  |     </template> | ||
|  |   </template> | ||
|  | </template> | ||
|  | 
 | ||
|  | <style scoped> | ||
|  | html:not(.dark) .VPImage.dark { | ||
|  |   display: none; | ||
|  | } | ||
|  | .dark .VPImage.light { | ||
|  |   display: none; | ||
|  | } | ||
|  | </style> |