1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2026-01-23 16:10:21 +08:00

fix(slot): 优化部分slot写法,减少手动判断 (#101)

* fix(slot): 优化部分slot写法,减少手动判断

* fix(slot): 优化部分slot写法,减少手动判断
This commit is contained in:
leip247
2024-11-13 11:05:03 +08:00
committed by GitHub
parent 69e6e9a14a
commit 6af6eb3c99
3 changed files with 36 additions and 31 deletions

View File

@@ -26,21 +26,22 @@
<!-- 底部按钮 -->
<template #footer>
<slot v-if="$slots.footer" name="footer" />
<footer v-else-if="modalOptions.showFooter" class="flex justify-end">
<n-button v-if="modalOptions.showCancel" @click="handleCancel()">
{{ modalOptions.cancelText }}
</n-button>
<n-button
v-if="modalOptions.showOk"
type="primary"
:loading="modalOptions.okLoading"
class="ml-20"
@click="handleOk()"
>
{{ modalOptions.okText }}
</n-button>
</footer>
<slot name="footer">
<footer v-if="modalOptions.showFooter" class="flex justify-end">
<n-button v-if="modalOptions.showCancel" @click="handleCancel()">
{{ modalOptions.cancelText }}
</n-button>
<n-button
v-if="modalOptions.showOk"
type="primary"
:loading="modalOptions.okLoading"
class="ml-20"
@click="handleOk()"
>
{{ modalOptions.okText }}
</n-button>
</footer>
</slot>
</template>
</n-card>
</n-modal>