Icon 图标选择器
选择icon
图标的组件,默认图标库使用@element-plus/icons-vue
,您也可以自行拓展本地文件或者三方图标库
基础用法
点击即可选中图标,再次点击取消选中。需要根据组件数量通过调整pagination
初始化属性进行组件最佳效果展示。pagination
属性同pagination
尺寸
可以通过icon-background-size
和icon-size
属性对尺寸进行调整
颜色
通过修改icon-color
、icon-background-color
、selected-color
、background-color
属性个性化你的展示
多选
使用multiple
属性来设置多选。 此时v-model
绑定的值变成数组。
使用自定义图标
通过icons
属性传递图标的svg
模板字符串,同时可以将use-default-icon
属性设置为false
屏蔽自带组件库
过滤
通过filter
属性可以对图标集进行过滤,可以配合search
插槽进行组件内过滤
自定义渲染
通过icon
插槽可以自定义渲染dom
,这在你项目里已经使用了三方icon
解析组件时很有用
与反馈组件一起使用
属性
属性名 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
v-model | 绑定值 | string/ string[] / null / undefined | — | — |
icons | 要添加的图标列表 | {name:string;val:string}[] | — | [] |
pagination | 分页属性,同pagination | — | — | — |
iconBackgroundSize | 图标背景的大小 | string | large / default / small | default |
filter | 过滤条件 | string | — | — |
iconColor | 图标颜色 | string | — | #000000 |
backgroundColor | 组件背景颜色 | string | — | #ffffff |
selectedColor | 选中的图标颜色 | string | — | #409eff |
iconSize | 图标大小 | number | — | 24 |
multiple | 多选 | boolean | — | false |
hiddenPagination | 是否隐藏分页,分页功能仍然可用,如果你需要自定义分页组件,请隐藏它 | boolean | — | false |
useDefaultIcon | 是否使用默认的图标集 | boolean | — | true |
scrollbar | 同 scrollbar | — | — | — |
插槽
插槽名 | 说明 |
---|---|
default | 自定义渲染区 |
search | 过滤组件区 |