it-tools/src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue
2024-09-29 22:35:51 +02:00

15 lines
529 B
Vue

<script setup lang="ts">
import type { Component } from 'vue';
const props = defineProps<{ icon: Component; title: string; action: () => void; isActive?: () => boolean; enabled?: () => boolean }>();
const { icon, title, action, isActive, enabled } = toRefs(props);
</script>
<template>
<c-tooltip :tooltip="title">
<c-button circle variant="text" :disabled="enabled && !enabled()" :type="isActive?.() ? 'primary' : 'default'" @click="action">
<n-icon :component="icon" />
</c-button>
</c-tooltip>
</template>