mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Cell): add icon-prefix prop (#5666)
This commit is contained in:
parent
aba946f20e
commit
51513d9423
@ -132,6 +132,7 @@ Vue.use(CellGroup);
|
|||||||
| title-class | Title className | *any* | - |
|
| title-class | Title className | *any* | - |
|
||||||
| value-class | Value className | *any* | - |
|
| value-class | Value className | *any* | - |
|
||||||
| label-class | Label className | *any* | - |
|
| label-class | Label className | *any* | - |
|
||||||
|
| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` |
|
||||||
|
|
||||||
### Cell Events
|
### Cell Events
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ Vue.use(CellGroup);
|
|||||||
| title-class | 左侧标题额外类名 | *any* | - |
|
| title-class | 左侧标题额外类名 | *any* | - |
|
||||||
| value-class | 右侧内容额外类名 | *any* | - |
|
| value-class | 右侧内容额外类名 | *any* | - |
|
||||||
| label-class | 描述信息额外类名 | *any* | - |
|
| label-class | 描述信息额外类名 | *any* | - |
|
||||||
|
| icon-prefix `v2.5.3` | 图标类名前缀 | *string* | `van-icon` |
|
||||||
|
|
||||||
### Cell Events
|
### Cell Events
|
||||||
|
|
||||||
|
@ -78,7 +78,13 @@ function Cell(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
return <Icon class={bem('left-icon')} name={icon} />;
|
return (
|
||||||
|
<Icon
|
||||||
|
class={bem('left-icon')}
|
||||||
|
name={icon}
|
||||||
|
classPrefix={props.iconPrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ export type SharedCellProps = {
|
|||||||
isLink?: boolean;
|
isLink?: boolean;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
clickable?: boolean;
|
clickable?: boolean;
|
||||||
|
iconPrefix?: string;
|
||||||
titleStyle?: any;
|
titleStyle?: any;
|
||||||
titleClass?: any;
|
titleClass?: any;
|
||||||
valueClass?: any;
|
valueClass?: any;
|
||||||
@ -23,6 +24,7 @@ export const cellProps = {
|
|||||||
isLink: Boolean,
|
isLink: Boolean,
|
||||||
required: Boolean,
|
required: Boolean,
|
||||||
clickable: Boolean,
|
clickable: Boolean,
|
||||||
|
iconPrefix: String,
|
||||||
titleStyle: null as any,
|
titleStyle: null as any,
|
||||||
titleClass: null as any,
|
titleClass: null as any,
|
||||||
valueClass: null as any,
|
valueClass: null as any,
|
||||||
|
@ -12,6 +12,11 @@ exports[`arrow direction 1`] = `
|
|||||||
<!----></i></div>
|
<!----></i></div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`icon-prefix prop 1`] = `
|
||||||
|
<div class="van-cell"><i class="my-icon my-icon-success van-cell__left-icon">
|
||||||
|
<!----></i></div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`render slot 1`] = `
|
exports[`render slot 1`] = `
|
||||||
<div class="van-cell">Custom Icon<div class="van-cell__title">Custom Title<div class="van-cell__label">Custom Label</div>
|
<div class="van-cell">Custom Icon<div class="van-cell__title">Custom Title<div class="van-cell__label">Custom Label</div>
|
||||||
</div>Custom Extra</div>
|
</div>Custom Extra</div>
|
||||||
|
@ -67,3 +67,14 @@ test('CellGroup title slot', () => {
|
|||||||
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('icon-prefix prop', () => {
|
||||||
|
const wrapper = mount(Cell, {
|
||||||
|
propsData: {
|
||||||
|
iconPrefix: 'my-icon',
|
||||||
|
icon: 'success',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user