diff --git a/packages/opendesign/src/dialog/ODialog.vue b/packages/opendesign/src/dialog/ODialog.vue index 3c351b88fafafa17db9c385c9b13303f1a2cfb25..bd261ad1b2bd7b12e61d338661836d7a017dffad 100644 --- a/packages/opendesign/src/dialog/ODialog.vue +++ b/packages/opendesign/src/dialog/ODialog.vue @@ -6,8 +6,9 @@ import { OScroller } from '../scroller'; import { dialogProps } from './types'; import { mergeClass } from '../_utils/dom'; -import { ref } from 'vue'; +import { computed, ref } from 'vue'; import { isPhonePad } from '../_utils/global'; +import { isBoolean } from '../_utils/is'; const props = defineProps(dialogProps); @@ -29,6 +30,14 @@ const onUpdateVisible = (value: boolean, e?: MouseEvent) => { emits('update:visible', value, e); }; +const isBodyScroller = computed(() => !!props.scroller); +const bodyScrollerOptions = computed(() => { + if (isBoolean(props.scroller)) { + return {}; + } + return props.scroller; +}); + defineExpose({ toggle(show?: boolean) { layerRef.value?.toggle(show); @@ -63,7 +72,7 @@ defineExpose({
- +
diff --git a/packages/opendesign/src/dialog/__demo__/DialogBasic.vue b/packages/opendesign/src/dialog/__demo__/DialogBasic.vue index 89df74f78804fc911257e31174314bd4325877ed..656f0ccb7db340dd58519f908e372d32863fe1d6 100644 --- a/packages/opendesign/src/dialog/__demo__/DialogBasic.vue +++ b/packages/opendesign/src/dialog/__demo__/DialogBasic.vue @@ -8,6 +8,15 @@ const content = 'This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog This is Dialog'; const showDlg = ref(false); const dlgSize = ref('medium'); +const hasHead = ref(false); +const hasFoot = ref(false); +const toggleHeadOrFoot = (type: 'foot' | 'head') => { + if (type === 'head') { + hasHead.value = !hasHead.value; + } else if (type === 'foot') { + hasFoot.value = !hasFoot.value; + } +}; const toggle = (show?: boolean, size: DialogSizeT = 'medium') => { dlgSize.value = size; if (show === undefined) { @@ -72,21 +81,24 @@ const onChane = (v: boolean) => {