返回 slidev
IconButton.vue
根目录 / packages / client / internals / IconButton.vue
1 <script setup lang="ts">
2 import { computed } from 'vue'
3
4 const props = defineProps<{
5 title: string
6 icon?: string
7 as?: string
8 to?: string
9 disabled?: boolean
10 active?: boolean
11 }>()
12
13 const type = computed(() => props.as || (props.to ? 'router-link' : 'button'))
14 </script>
15
16 <template>
17 <component :is="type" class="slidev-icon-btn" :class="{ disabled, active }" :title="title" :to="to">
18 <span class="sr-only">{{ title }}</span>
19 <slot>
20 <div :class="icon" />
21 </slot>
22 </component>
23 </template>
24
24 lines Plain Text