diff --git a/src/cell/README.md b/src/cell/README.md index 84cf1b072..0181dfc31 100644 --- a/src/cell/README.md +++ b/src/cell/README.md @@ -132,6 +132,7 @@ Vue.use(CellGroup); | title-class | Title className | *any* | - | | value-class | Value className | *any* | - | | label-class | Label className | *any* | - | +| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` | ### Cell Events diff --git a/src/cell/README.zh-CN.md b/src/cell/README.zh-CN.md index 8efdc3e39..93c2ce482 100644 --- a/src/cell/README.zh-CN.md +++ b/src/cell/README.zh-CN.md @@ -143,6 +143,7 @@ Vue.use(CellGroup); | title-class | 左侧标题额外类名 | *any* | - | | value-class | 右侧内容额外类名 | *any* | - | | label-class | 描述信息额外类名 | *any* | - | +| icon-prefix `v2.5.3` | 图标类名前缀 | *string* | `van-icon` | ### Cell Events diff --git a/src/cell/index.tsx b/src/cell/index.tsx index 505237476..c1a741ea2 100644 --- a/src/cell/index.tsx +++ b/src/cell/index.tsx @@ -78,7 +78,13 @@ function Cell( } if (icon) { - return ; + return ( + + ); } } diff --git a/src/cell/shared.ts b/src/cell/shared.ts index 9553abf88..f3c2ec949 100644 --- a/src/cell/shared.ts +++ b/src/cell/shared.ts @@ -6,6 +6,7 @@ export type SharedCellProps = { isLink?: boolean; required?: boolean; clickable?: boolean; + iconPrefix?: string; titleStyle?: any; titleClass?: any; valueClass?: any; @@ -23,6 +24,7 @@ export const cellProps = { isLink: Boolean, required: Boolean, clickable: Boolean, + iconPrefix: String, titleStyle: null as any, titleClass: null as any, valueClass: null as any, diff --git a/src/cell/test/__snapshots__/index.spec.js.snap b/src/cell/test/__snapshots__/index.spec.js.snap index 2ede87136..cd68daa26 100644 --- a/src/cell/test/__snapshots__/index.spec.js.snap +++ b/src/cell/test/__snapshots__/index.spec.js.snap @@ -12,6 +12,11 @@ exports[`arrow direction 1`] = ` `; +exports[`icon-prefix prop 1`] = ` +
+
+`; + exports[`render slot 1`] = `
Custom Icon
Custom Title
Custom Label
Custom Extra
diff --git a/src/cell/test/index.spec.js b/src/cell/test/index.spec.js index b5969f6fd..0fd6b240d 100644 --- a/src/cell/test/index.spec.js +++ b/src/cell/test/index.spec.js @@ -67,3 +67,14 @@ test('CellGroup title slot', () => { expect(wrapper).toMatchSnapshot(); }); + +test('icon-prefix prop', () => { + const wrapper = mount(Cell, { + propsData: { + iconPrefix: 'my-icon', + icon: 'success', + }, + }); + + expect(wrapper).toMatchSnapshot(); +});