Icons
Rappel-UI svg-icons库提供常见的图标使用,可以直接使用图标组件,也可以结合组件<ReSvgIcon />通过传入path属性使用
你可以直接使用icons库组件,也可以引入 svgIcons 对象,配合 <ReSvgIcon /> 标签使用
Basic SVG Icons Component
Use Icon by ReSvgIcon Component
vue
<template>
<div>
<p>Basic SVG Icons Component</p>
<div class="icons-demo">
<Star stroke-width="2" size="24px" />
<StarFill stroke-width="1" size="24px" />
</div>
<p>Use Icon by ReSvgIcon Component</p>
<div class="icons-demo">
<div
v-for="item in svgIcons"
:key="item.path"
class="icon-item"
:title="item.name"
@click.stop="copy(item)"
>
<re-svg-icon
size="24px"
:path="item.path"
:name="item.name"
stroke-width="2"
:fill="item.fill"
/>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { svgIcons, Star, StarFill } from '@rappel-ui/svg-icons'
import { ReSvgIcon } from '@rappel-ui/components'
import { copyText } from '@rappel-ui/utils'
const copy = (item: any) => {
copyText(item.name)
.then((res) => {
console.warn(res, 'copy', item.name)
})
.catch((err) => {
console.warn(err, 'copy fail')
})
}
</script>
<style lang="scss" scoped>
.icons-demo {
display: flex;
flex-wrap: wrap;
gap: 1em;
.icon-item {
cursor: pointer;
color: var(--vp-icon-color);
&:hover {
color: var(--vp-icon-hover-color);
}
}
}
</style>