diff --git a/src/dialog/__tests__/index.test.jsx b/src/dialog/__tests__/index.test.jsx index c643de1fe5..18c5d17167 100644 --- a/src/dialog/__tests__/index.test.jsx +++ b/src/dialog/__tests__/index.test.jsx @@ -81,6 +81,16 @@ describe('Dialog', () => { expect(header.text()).toBe('this is header'); }); + it(':header:false', async () => { + const visible = ref(true); + const wrapper = mount(() => ( + + )); + const header = wrapper.find('.t-dialog__header'); + await nextTick(); + expect(header.exists()).toBeFalsy(); + }); + it(':placement', async () => { const placementList = ['top', 'center']; const visible = ref(true); diff --git a/src/dialog/dialog.tsx b/src/dialog/dialog.tsx index 9512b5cdb8..1503c33ffc 100644 --- a/src/dialog/dialog.tsx +++ b/src/dialog/dialog.tsx @@ -330,6 +330,11 @@ export default defineComponent({ })} ); + + const headerContent = renderTNodeJSX('header', defaultHeader); + + const footerContent = renderTNodeJSX('footer', defaultFooter); + const headerClassName = isFullScreen.value ? [`${COMPONENT_NAME.value}__header`, `${COMPONENT_NAME.value}__header--fullscreen`] : `${COMPONENT_NAME.value}__header`; @@ -341,8 +346,6 @@ export default defineComponent({ const bodyClassName = props.theme === 'default' ? [`${COMPONENT_NAME.value}__body`] : [`${COMPONENT_NAME.value}__body__icon`]; - const footerContent = renderTNodeJSX('footer', defaultFooter); - if (isFullScreen.value && footerContent) { bodyClassName.push(`${COMPONENT_NAME.value}__body--fullscreen`); } else if (isFullScreen.value) { @@ -374,18 +377,20 @@ export default defineComponent({ v-draggable={isModeLess.value && props.draggable} ref={dialogEle} > -