feat: 图标选择器组件支持清空已选图标

This commit is contained in:
ray
2024-10-24 11:30:57 +08:00
parent 8914e6cf51
commit 4786a50c2b

View File

@@ -24,6 +24,15 @@
</template>
</template>
<template #suffix>
<!-- 清空按钮 -->
<el-icon
v-if="selectedIcon"
style="margin-right: 8px"
@click.stop="clearSelectedIcon"
>
<CircleClose />
</el-icon>
<el-icon
:style="{
transform: popoverVisible ? 'rotate(180deg)' : 'rotate(0)',
@@ -165,6 +174,13 @@ onClickOutside(iconSelectRef, () => (popoverVisible.value = false), {
ignore: [popoverContentRef],
});
/**
* 清空已选图标
*/
function clearSelectedIcon() {
selectedIcon.value = "";
}
onMounted(() => {
loadIcons();
if (selectedIcon.value) {