This commit is contained in:
王念超
2024-06-11 16:14:14 +08:00
parent b4e16be6e6
commit e48c097d90
8 changed files with 345 additions and 138 deletions

View File

@@ -7,19 +7,55 @@ import {Icon} from "@iconify/vue";
defineProps<{
title?: string,
icon: string,
disabled?: boolean,
}>()
defineEmits(['click'])
const emit = defineEmits(['click'])
</script>
<template>
<Tooltip :title="title">
<IconWrapper v-bind="$attrs" @click.stop="$emit('click')">
<Icon :icon="icon"/>
</IconWrapper>
<div
v-bind="$attrs"
@click="e => (!disabled) && emit('click',e)"
class="icon-wrapper"
:class="{disabled}"
>
<Icon :icon="icon"/>
</div>
</Tooltip>
</template>
<style scoped lang="scss">
$w: 1.4rem;
.icon-wrapper {
cursor: pointer;
//padding: 2rem;
width: 2rem;
height: 2rem;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: .3rem;
background: transparent;
transition: all .3s;
//color: var(--color-main-active);
&:hover:not(.disabled) {
background: var(--color-primary);
color: white;
}
&.disabled {
cursor: not-allowed;
opacity: .3;
}
:deep(svg) {
width: $w;
height: $w;
}
}
</style>