feat(GridItem): add icon-color prop (#8753)

This commit is contained in:
FunkyZc
2021-05-23 15:45:59 +08:00
committed by GitHub
parent 10daea86c5
commit 00d42df574
4 changed files with 17 additions and 0 deletions
+1
View File
@@ -120,6 +120,7 @@ app.use(GridItem);
| text | Text | _string_ | - |
| icon | Icon name or URL | _string_ | - |
| icon-prefix | Icon className prefix | _string_ | `van-icon` |
| icon-color | Icon color | _string_ | - |
| dot | Whether to show red dot | _boolean_ | `false` |
| badge | Content of the badge | _number \| string_ | - |
| url | Link URL | _string_ | - |
+1
View File
@@ -136,6 +136,7 @@ app.use(GridItem);
| text | 文字 | _string_ | - |
| icon | [图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
| icon-prefix | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| icon-color | 图标颜色,同 Icon 组件的 [color 属性](#/zh-CN/icon#props) | _string_ | - |
| dot | 是否显示图标右上角小红点 | _boolean_ | `false` |
| badge | 图标右上角徽标的内容 | _number \| string_ | - |
| url | 点击后跳转的链接地址 | _string_ | - |
+13
View File
@@ -32,6 +32,19 @@ test('should change icon size when using icon-size prop', () => {
expect(wrapper.find('.van-grid-item__icon').style.fontSize).toEqual('10px');
});
test('should change icon color when using icon-color prop', () => {
const wrapper = mount({
render() {
return (
<Grid>
<GridItem icon="success" icon-color="red" />
</Grid>
);
},
});
expect(wrapper.find('.van-grid-item__icon').style.color).toEqual('red');
});
test('should render icon-slot correctly', () => {
const wrapper = mount({
render() {