Commit ae7821e29690bea8934ea724bfd0ae4e2cf30c77
1 parent
a1d956d3
fix(modal): ensure that props are passed correctly,fix #897
Showing
5 changed files
with
7 additions
and
7 deletions
CHANGELOG.zh_CN.md
src/components/Modal/src/BasicModal.vue
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | </template> |
19 | 19 | |
20 | 20 | <template #footer v-if="!$slots.footer"> |
21 | - <ModalFooter v-bind="getProps" @ok="handleOk" @cancel="handleCancel"> | |
21 | + <ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel"> | |
22 | 22 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
23 | 23 | <slot :name="item" v-bind="data"></slot> |
24 | 24 | </template> |
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | setup(props, { emit, attrs }) { |
83 | 83 | const visibleRef = ref(false); |
84 | 84 | const propsRef = ref<Partial<ModalProps> | null>(null); |
85 | - const modalWrapperRef = ref<ComponentRef>(null); | |
85 | + const modalWrapperRef = ref<any>(null); | |
86 | 86 | |
87 | 87 | // modal Bottom and top height |
88 | 88 | const extHeightRef = ref(0); |
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | }); |
134 | 134 | |
135 | 135 | const getBindValue = computed((): Recordable => { |
136 | - const attr = { ...attrs, ...unref(getProps) }; | |
136 | + const attr = { ...attrs, ...unref(getMergeProps), visible: unref(visibleRef) }; | |
137 | 137 | if (unref(fullScreenRef)) { |
138 | 138 | return omit(attr, 'height'); |
139 | 139 | } | ... | ... |
src/views/demo/comp/modal/Modal1.vue
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | @visible-change="handleShow" |
9 | 9 | > |
10 | 10 | <template #insertFooter> |
11 | - <a-button type="danger" @click="setLines" :disabled="loading">点我更新内容</a-button> | |
11 | + <a-button type="primary" danger @click="setLines" :disabled="loading">点我更新内容</a-button> | |
12 | 12 | </template> |
13 | 13 | <template v-if="loading"> |
14 | 14 | <div class="empty-tips"> 加载中,稍等3秒…… </div> | ... | ... |
src/views/demo/comp/modal/Modal2.vue
1 | 1 | <template> |
2 | 2 | <BasicModal |
3 | - v-bind="$attrs" | |
4 | 3 | @register="register" |
5 | 4 | title="Modal Title" |
6 | 5 | :helpMessage="['提示1', '提示2']" |
6 | + :okButtonProps="{ disabled: true }" | |
7 | 7 | > |
8 | 8 | <a-button type="primary" @click="closeModal" class="mr-2"> 从内部关闭弹窗 </a-button> |
9 | - | |
10 | 9 | <a-button type="primary" @click="setModalProps"> 从内部修改title </a-button> |
11 | 10 | </BasicModal> |
12 | 11 | </template> | ... | ... |
src/views/demo/system/account/AccountDetail.vue