Skip to content

XIcon 关闭图标

一个带悬停动效的「关闭 ✕」图标。

基础用法

将鼠标移到图标上查看展开动画。

悬停展开
color
size = 56
strokeWidth / lineWidth
duration = 1200ms
查看代码
vue
<template>
    <div style="display: flex; flex-wrap: wrap; gap: 40px; align-items: center">
        <!-- 基础用法:悬停展开成 X -->
        <div style="text-align: center">
            <XIcon />
            <div style="margin-top: 8px; font-size: 12px; color: #888">悬停展开</div>
        </div>

        <!-- 自定义颜色 -->
        <div style="text-align: center">
            <XIcon color="#646cff" />
            <div style="margin-top: 8px; font-size: 12px; color: #888">color</div>
        </div>

        <!-- 自定义尺寸(number,单位 px) -->
        <div style="text-align: center">
            <XIcon :size="56" />
            <div style="margin-top: 8px; font-size: 12px; color: #888">size = 56</div>
        </div>

        <!-- 自定义线条粗细 -->
        <div style="text-align: center">
            <XIcon :stroke-width="3" :line-width="4" />
            <div style="margin-top: 8px; font-size: 12px; color: #888">strokeWidth / lineWidth</div>
        </div>

        <!-- 自定义动画时长(ms) -->
        <div style="text-align: center">
            <XIcon :duration="1200" color="#e5484d" />
            <div style="margin-top: 8px; font-size: 12px; color: #888">duration = 1200ms</div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { XIcon } from "@a-drowned-fish/rox-v";
</script>

Props

参数说明类型默认值
color图标颜色string"#000000"
size图标整体尺寸(数字,单位 px,同时作用于宽高)number34
strokeWidth四周边框线的粗细(单位 px)number1
lineWidth中央 X 线条的粗细(单位 px)number1
duration动画时长number600

Events

事件名说明回调参数
click点击图标时触发() => void

基于 MIT 协议开源