diff --git a/src/overlay/README.md b/src/overlay/README.md index 64f056df7..fc2cd9a88 100644 --- a/src/overlay/README.md +++ b/src/overlay/README.md @@ -39,6 +39,7 @@ export default { | z-index | z-index | *string \| number* | `1` | - | | duration | Animation duration | *string \| number* | `0.3` | - | | class-name | ClassName | *string* | - | - | +| custom-class | Custom style | *object* | - | - | ### Events diff --git a/src/overlay/README.zh-CN.md b/src/overlay/README.zh-CN.md index f09fcc3fc..7b59dedc5 100644 --- a/src/overlay/README.zh-CN.md +++ b/src/overlay/README.zh-CN.md @@ -43,6 +43,7 @@ export default { | z-index | z-index 层级 | *string \| number* | `1` | - | | duration | 动画时长,单位秒 | *string \| number* | `0.3` | - | | class-name | 自定义类名 | *string* | - | - | +| custom-style | 自定义样式 | *object* | - | - | ### Events diff --git a/src/overlay/index.tsx b/src/overlay/index.tsx index ccad92349..eb374720f 100644 --- a/src/overlay/index.tsx +++ b/src/overlay/index.tsx @@ -11,7 +11,7 @@ export type OverlayProps = { zIndex?: number | string; duration: number | string | null; className?: any; - customStyle?: any; + customStyle?: object; }; export type OverlayEvents = { @@ -58,7 +58,7 @@ Overlay.props = { show: Boolean, duration: [Number, String], className: null as any, - customStyle: null as any, + customStyle: Object, zIndex: { type: [Number, String], default: 1 diff --git a/src/overlay/test/__snapshots__/index.spec.js.snap b/src/overlay/test/__snapshots__/index.spec.js.snap index 5f30aa06b..73bf23000 100644 --- a/src/overlay/test/__snapshots__/index.spec.js.snap +++ b/src/overlay/test/__snapshots__/index.spec.js.snap @@ -2,6 +2,8 @@ exports[`class-name prop 1`] = `
`; +exports[`custom style prop 1`] = `
`; + exports[`default slot 1`] = ``; exports[`duration prop 1`] = `
`; diff --git a/src/overlay/test/index.spec.js b/src/overlay/test/index.spec.js index 18a069c81..0d4094a66 100644 --- a/src/overlay/test/index.spec.js +++ b/src/overlay/test/index.spec.js @@ -23,6 +23,19 @@ test('class-name prop', () => { expect(wrapper).toMatchSnapshot(); }); +test('custom style prop', () => { + const wrapper = mount(Overlay, { + propsData: { + show: true, + customStyle: { + backgroundColor: 'red' + } + } + }); + + expect(wrapper).toMatchSnapshot(); +}); + test('duration prop', () => { const wrapper = mount(Overlay, { propsData: {