Files
open-anylink-web/src/components/common/AddButton.vue

43 lines
893 B
Vue
Raw Normal View History

<script setup>
2024-11-11 16:39:59 +08:00
import { computed } from 'vue'
2024-10-30 22:10:34 +08:00
import { Plus } from '@element-plus/icons-vue'
const props = defineProps(['size'])
2024-11-11 16:39:59 +08:00
// 实际大小要减去border的宽度
const actualSize = computed(() => {
return `${props.size - 1}px`
})
</script>
<template>
2024-11-11 16:39:59 +08:00
<div class="circle">
2024-10-30 22:10:34 +08:00
<el-icon :size="18"><Plus /></el-icon>
</div>
</template>
<style lang="scss" scoped>
2024-10-30 22:10:34 +08:00
.circle {
width: v-bind('actualSize'); //CSS中使用script的变量
height: v-bind('actualSize'); //CSS中使用script的变量
min-width: v-bind('actualSize');
min-height: v-bind('actualSize');
2024-10-30 22:10:34 +08:00
border: solid 1px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
--hoverColor: gray;
color: var(--hoverColor);
&:hover {
--hoverColor: #409eff;
color: var(--hoverColor);
}
.el-icon {
color: var(--hoverColor);
}
}
</style>