refactor(components/modal): remove default footer button

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/581/head
Ryan Wang 2022-04-27 14:06:02 +08:00
parent c39e13350e
commit a7f115f948
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { VButton } from "@/components/base/button";
import { VModal } from "@/components/base/modal";
import { VSpace } from "@/components/base/space";
function initState() {
return {
@ -26,7 +27,15 @@ function initState() {
<img src="https://ryanc.cc/avatar" class="w-full" />
<img src="https://halo.run/logo" class="w-full" />
</div>
<VButton type="secondary" @click="state.visible = false">关闭</VButton>
<template #footer>
<VSpace>
<VButton type="primary" @click="state.visible = false" loading
>确定</VButton
>
<VButton @click="state.visible = false">取消</VButton>
</VSpace>
</template>
</VModal>
</template>
<template #controls="{ state }">

View File

@ -1,5 +1,4 @@
<script lang="ts" setup>
import { VButton } from "../button";
import { computed } from "vue";
import { IconClose } from "@/core/icons";
@ -72,10 +71,8 @@ function handleClose() {
<div class="modal-body">
<slot />
</div>
<div class="modal-footer">
<slot name="footer">
<VButton @click="handleClose"></VButton>
</slot>
<div v-if="$slots.footer" class="modal-footer">
<slot name="footer" />
</div>
</div>
</div>