mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Popup): add overlay-content slot (#8794)
This commit is contained in:
parent
bd72be8f6a
commit
1bc497f3b3
@ -202,7 +202,7 @@ test('month-show event', async () => {
|
|||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await later(100);
|
await later(200);
|
||||||
|
|
||||||
expect(wrapper.emitted('month-show')).toBeTruthy();
|
expect(wrapper.emitted('month-show')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
@ -132,6 +132,7 @@ export default defineComponent({
|
|||||||
if (props.overlay) {
|
if (props.overlay) {
|
||||||
return (
|
return (
|
||||||
<Overlay
|
<Overlay
|
||||||
|
v-slots={{ default: slots['overlay-content'] }}
|
||||||
show={props.show}
|
show={props.show}
|
||||||
class={props.overlayClass}
|
class={props.overlayClass}
|
||||||
zIndex={zIndex.value}
|
zIndex={zIndex.value}
|
||||||
|
@ -154,6 +154,13 @@ export default {
|
|||||||
| opened | Emitted when Popup is opened | - |
|
| opened | Emitted when Popup is opened | - |
|
||||||
| closed | Emitted when Popup is closed | - |
|
| closed | Emitted when Popup is closed | - |
|
||||||
|
|
||||||
|
### Slots
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ------------------------- | ------------------------ |
|
||||||
|
| default | Content of Popup |
|
||||||
|
| overlay-content `v3.0.18` | Content of Popup overlay |
|
||||||
|
|
||||||
### Less Variables
|
### Less Variables
|
||||||
|
|
||||||
How to use: [Custom Theme](#/en-US/theme).
|
How to use: [Custom Theme](#/en-US/theme).
|
||||||
|
@ -158,6 +158,13 @@ export default {
|
|||||||
| opened | 打开弹出层且动画结束后触发 | - |
|
| opened | 打开弹出层且动画结束后触发 | - |
|
||||||
| closed | 关闭弹出层且动画结束后触发 | - |
|
| closed | 关闭弹出层且动画结束后触发 | - |
|
||||||
|
|
||||||
|
### Slots
|
||||||
|
|
||||||
|
| 名称 | 说明 |
|
||||||
|
| ------------------------- | ------------ |
|
||||||
|
| default | 弹窗内容 |
|
||||||
|
| overlay-content `v3.0.18` | 遮罩层的内容 |
|
||||||
|
|
||||||
### 样式变量
|
### 样式变量
|
||||||
|
|
||||||
组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考[主题定制](#/zh-CN/theme)。
|
组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考[主题定制](#/zh-CN/theme)。
|
||||||
|
@ -23,3 +23,15 @@ exports[`should render correct close icon when using close-icon prop 1`] = `
|
|||||||
>
|
>
|
||||||
</i>
|
</i>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`should render overlay-content slot correctly 1`] = `
|
||||||
|
<transition-stub>
|
||||||
|
<div class="van-overlay">
|
||||||
|
Custom Overlay Content
|
||||||
|
</div>
|
||||||
|
</transition-stub>
|
||||||
|
<transition-stub>
|
||||||
|
<div class="van-popup van-popup--center">
|
||||||
|
</div>
|
||||||
|
</transition-stub>
|
||||||
|
`;
|
||||||
|
@ -201,3 +201,16 @@ test('should change icon class prefix when using icon-prefix prop', () => {
|
|||||||
|
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should render overlay-content slot correctly', () => {
|
||||||
|
const wrapper = mount(Popup, {
|
||||||
|
props: {
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
|
slots: {
|
||||||
|
'overlay-content': () => 'Custom Overlay Content',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user