TnIcon-图标 基于字体的图标集,图鸟将所有图标进行了统一化,重绘了大多数的常见图标。
平台差异说明 App(vue)H5微信小程序支付宝小程序...√√√√适配中单独使用 图鸟为了方便开发者单独使用 icon 图标字体,将 icon 的字体图标字体单独分出一个 node 包进行管理
可以通过以下命令安装更新到指定版本的图鸟 icon 图标字体
bashnpm install @tuniao/tn-icon@<版本号>npm install @tuniao/tn-icon@<版本号>1基本使用 1. 单独引入 由于图鸟在这次的更新中将 icon 图标字体单独出来了,在图鸟 ui 框架之外使用仅需将对应的 css 文件引入即可。
css 文件所在位置
@import '@tuniao/tn-icon/dist/index.css'@import '@tuniao/tn-icon/dist/index.css'1图鸟 icon 图标字体是使用tn-icon-<图标名称>做为类名
2.1 使用 tuniaoui-vue3-uniappUI 组件库 TnIcon组件所在位置
typescriptimport TnIcon from '@tuniao/tnui-vue3-uniapp/components/icon/src/icon.vue'import TnIcon from '@tuniao/tnui-vue3-uniapp/components/icon/src/icon.vue'12.2 使用 uni_modules 组件库 TnIcon组件所在位置
typescriptimport TnIcon from '@/uni_modules/tuniaoui-vue3/components/icon/src/icon.vue'import TnIcon from '@/uni_modules/tuniaoui-vue3/components/icon/src/icon.vue'1通过TnIcon形式来调用,设置name来设置图标
vue
这里只需给name参数传入一个图片的地址即可,但是这里只支持绝对路径和网络图片,在这只为图片图标之后的size属性用于设置图片的宽高大小,由于是图片,color等参数会失效
vue
vue
vue
import type { CSSProperties } from 'vue'
const style: CSSProperties = {
fontSize: '20px',
color: 'red',
}
import type { CSSProperties } from 'vue'
const style: CSSProperties = {
fontSize: '20px',
color: 'red',
}
123456789101112API Props 参数说明类型默认值可选值name图标名称,详细名称见图标展示,如果带/会被认为是图片图标String--type图标颜色类型String-primary / success / warning / danger / infocolor图标颜色,支持图鸟内置的颜色值、hex、rgb、rgba 值String--size图标尺寸大小,默认单位为 rpx,可以传入带单位的尺寸值String | Number--bold是否加粗图标Booleanfalsetruetransparent是否为透明图标Booleanfalsetruetransparent-bg设置透明图标的背景色,需要搭配transparent使用,可以使用图鸟内置的背景色、hex、rgb、rgbaString--img-mode图片模式,在图片图标下有效StringaspectFitscaleToFill / aspectFit / aspectFill / widthFix / heightFix / top / bottom / center / left / right / top left / top right / bottom left / bottom rightoffset-top垂直方向上的偏移量String | Number--custom-style自定义样式Object--custom-class自定义类名String--Event 事件名说明回调参数click点击图标时触发-图标展示 点击图标可以复制图标名称。