-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(modal): add redoModalHeight for useModalInner
允许在Modal内部动态加载内容后重新调整高度
- Loading branch information
Showing
4 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,51 @@ | ||
<template> | ||
<BasicModal v-bind="$attrs" title="Modal Title" :helpMessage="['提示1', '提示2']"> | ||
Modal Info. | ||
<BasicModal | ||
v-bind="$attrs" | ||
destroyOnClose | ||
@register="register" | ||
title="Modal Title" | ||
:helpMessage="['提示1', '提示2']" | ||
@visible-change="handleShow" | ||
> | ||
<template v-if="loading"> | ||
<div class="empty-tips"> 加载中,稍等3秒…… </div> | ||
</template> | ||
<template v-if="!loading"> | ||
<ul> | ||
<li v-for="index in lines" :key="index">加载完成{{ index }}!</li> | ||
</ul> | ||
</template> | ||
</BasicModal> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { BasicModal } from '/@/components/Modal'; | ||
import { defineComponent, ref } from 'vue'; | ||
import { BasicModal, useModalInner } from '/@/components/Modal'; | ||
export default defineComponent({ | ||
components: { BasicModal }, | ||
setup() { | ||
const loading = ref(true); | ||
const lines = ref(10); | ||
const [register, { setModalProps, redoModalHeight }] = useModalInner(); | ||
function handleShow(visible: boolean) { | ||
if (visible) { | ||
loading.value = true; | ||
setModalProps({ loading: true }); | ||
setTimeout(() => { | ||
lines.value = Math.round(Math.random() * 20 + 10); | ||
loading.value = false; | ||
setModalProps({ loading: false }); | ||
redoModalHeight(); | ||
}, 3000); | ||
} | ||
} | ||
return { register, loading, handleShow, lines }; | ||
}, | ||
}); | ||
</script> | ||
<style scoped> | ||
.empty-tips { | ||
height: 100px; | ||
line-height: 100px; | ||
text-align: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters