Skip to content

Commit

Permalink
fix(modal): ensure that props are passed correctly,fix #897
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Jul 13, 2021
1 parent a1d956d commit ae7821e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- 修复菜单默认折叠的配置不起作用的问题
- 修复`safari`浏览器报错导致网站打不开
- 修复在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题
- **Modal** 确保 props 正确被传递

### 🎫 Chores

Expand Down
6 changes: 3 additions & 3 deletions src/components/Modal/src/BasicModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</template>

<template #footer v-if="!$slots.footer">
<ModalFooter v-bind="getProps" @ok="handleOk" @cancel="handleCancel">
<ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
</template>
Expand Down Expand Up @@ -82,7 +82,7 @@
setup(props, { emit, attrs }) {
const visibleRef = ref(false);
const propsRef = ref<Partial<ModalProps> | null>(null);
const modalWrapperRef = ref<ComponentRef>(null);
const modalWrapperRef = ref<any>(null);
// modal Bottom and top height
const extHeightRef = ref(0);
Expand Down Expand Up @@ -133,7 +133,7 @@
});
const getBindValue = computed((): Recordable => {
const attr = { ...attrs, ...unref(getProps) };
const attr = { ...attrs, ...unref(getMergeProps), visible: unref(visibleRef) };
if (unref(fullScreenRef)) {
return omit(attr, 'height');
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/demo/comp/modal/Modal1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@visible-change="handleShow"
>
<template #insertFooter>
<a-button type="danger" @click="setLines" :disabled="loading">点我更新内容</a-button>
<a-button type="primary" danger @click="setLines" :disabled="loading">点我更新内容</a-button>
</template>
<template v-if="loading">
<div class="empty-tips"> 加载中,稍等3秒…… </div>
Expand Down
3 changes: 1 addition & 2 deletions src/views/demo/comp/modal/Modal2.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<template>
<BasicModal
v-bind="$attrs"
@register="register"
title="Modal Title"
:helpMessage="['提示1', '提示2']"
:okButtonProps="{ disabled: true }"
>
<a-button type="primary" @click="closeModal" class="mr-2"> 从内部关闭弹窗 </a-button>

<a-button type="primary" @click="setModalProps"> 从内部修改title </a-button>
</BasicModal>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/views/demo/system/account/AccountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@back="goBack"
>
<template #extra>
<a-button type="danger"> 禁用账号 </a-button>
<a-button type="primary" danger> 禁用账号 </a-button>
<a-button type="primary"> 修改密码 </a-button>
</template>
<template #footer>
Expand Down

0 comments on commit ae7821e

Please sign in to comment.