使用用例

Icon 一般用法

icon
icon
geo
icon
icon
icon
使用drop-shadow 来改变icon的颜色表现
<template>
  <GIcon :src="ElementWebp.Geo" />
  <GIcon type="origin" :src="ElementWebp.Geo" :size="50" />
  <GIcon type="origin" :src="ElementWebp.Geo" :size="80" alt="geo" />

  <GIcon type="projection" color="red" :src="ElementPng.Geo" />
  <GIcon type="projection" color="blue" :src="ElementPng.Geo" :size="50" />
  <GIcon type="projection" color="green" :src="ElementPng.Geo" :size="80" />
</template>
<script setup>
  import { ElementWebp, ElementPng } from '@shi-zhong/genshin-ui'
</script>

类型定义

interface IconCommon {
  src: string;
  alt?: string;
  size?: number;
  imgStyle?: object;
}

interface IconPropsOrigin {
  type: 'origin';
}

interface IconPropsProjection {
  type: 'projection';
  color: string;
}

type IconProps = IconCommon & (IconPropsOrigin | IconPropsProjection);

const props = withDefaults(defineProps<IconProps>(), {
  type: 'origin',
  size: 20,
  color: 'white'
});

类型说明

参数说明类型可选值默认值
type原始 / 投射stringorigin projectionorigin
src图片资源string
alt图片描述string
size图片尺寸number20
color图片颜色stringwhite
imgStyle图片样式,同 styleobject
Last Updated:
Contributors: shi-zhong