mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Overlay): add custom-style prop (#4572)
This commit is contained in:
parent
a70c0ac5f4
commit
89d97ee5cb
@ -39,6 +39,7 @@ export default {
|
|||||||
| z-index | z-index | *string \| number* | `1` | - |
|
| z-index | z-index | *string \| number* | `1` | - |
|
||||||
| duration | Animation duration | *string \| number* | `0.3` | - |
|
| duration | Animation duration | *string \| number* | `0.3` | - |
|
||||||
| class-name | ClassName | *string* | - | - |
|
| class-name | ClassName | *string* | - | - |
|
||||||
|
| custom-class | Custom style | *object* | - | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ export default {
|
|||||||
| z-index | z-index 层级 | *string \| number* | `1` | - |
|
| z-index | z-index 层级 | *string \| number* | `1` | - |
|
||||||
| duration | 动画时长,单位秒 | *string \| number* | `0.3` | - |
|
| duration | 动画时长,单位秒 | *string \| number* | `0.3` | - |
|
||||||
| class-name | 自定义类名 | *string* | - | - |
|
| class-name | 自定义类名 | *string* | - | - |
|
||||||
|
| custom-style | 自定义样式 | *object* | - | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ export type OverlayProps = {
|
|||||||
zIndex?: number | string;
|
zIndex?: number | string;
|
||||||
duration: number | string | null;
|
duration: number | string | null;
|
||||||
className?: any;
|
className?: any;
|
||||||
customStyle?: any;
|
customStyle?: object;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type OverlayEvents = {
|
export type OverlayEvents = {
|
||||||
@ -58,7 +58,7 @@ Overlay.props = {
|
|||||||
show: Boolean,
|
show: Boolean,
|
||||||
duration: [Number, String],
|
duration: [Number, String],
|
||||||
className: null as any,
|
className: null as any,
|
||||||
customStyle: null as any,
|
customStyle: Object,
|
||||||
zIndex: {
|
zIndex: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
exports[`class-name prop 1`] = `<div class="van-overlay my-overlay" style="z-index: 1;" name="van-fade"></div>`;
|
exports[`class-name prop 1`] = `<div class="van-overlay my-overlay" style="z-index: 1;" name="van-fade"></div>`;
|
||||||
|
|
||||||
|
exports[`custom style prop 1`] = `<div class="van-overlay" style="z-index: 1; background-color: red;" name="van-fade"></div>`;
|
||||||
|
|
||||||
exports[`default slot 1`] = `<div class="van-overlay" style="z-index: 1; display: none;" name="van-fade">Custom Default</div>`;
|
exports[`default slot 1`] = `<div class="van-overlay" style="z-index: 1; display: none;" name="van-fade">Custom Default</div>`;
|
||||||
|
|
||||||
exports[`duration prop 1`] = `<div class="van-overlay" style="z-index: 1; animation-duration: 1s;" name="van-fade"></div>`;
|
exports[`duration prop 1`] = `<div class="van-overlay" style="z-index: 1; animation-duration: 1s;" name="van-fade"></div>`;
|
||||||
|
@ -23,6 +23,19 @@ test('class-name prop', () => {
|
|||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('custom style prop', () => {
|
||||||
|
const wrapper = mount(Overlay, {
|
||||||
|
propsData: {
|
||||||
|
show: true,
|
||||||
|
customStyle: {
|
||||||
|
backgroundColor: 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
test('duration prop', () => {
|
test('duration prop', () => {
|
||||||
const wrapper = mount(Overlay, {
|
const wrapper = mount(Overlay, {
|
||||||
propsData: {
|
propsData: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user