mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-05-01 06:39:01 +08:00
fix(slot): 优化部分slot写法,减少手动判断 (#101)
* fix(slot): 优化部分slot写法,减少手动判断 * fix(slot): 优化部分slot写法,减少手动判断
This commit is contained in:
parent
69e6e9a14a
commit
6af6eb3c99
@ -11,8 +11,9 @@
|
|||||||
<main :class="{ 'flex-1': full }" class="m-12">
|
<main :class="{ 'flex-1': full }" class="m-12">
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
<slot v-if="$slots.footer" name="footer" />
|
<slot name="footer">
|
||||||
<TheFooter v-else-if="showFooter" class="mb-12 mt-auto" />
|
<TheFooter v-if="showFooter" class="mb-12 mt-auto" />
|
||||||
|
</slot>
|
||||||
<n-back-top :bottom="20" />
|
<n-back-top :bottom="20" />
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
<slot v-if="$slots.header" name="header" />
|
<slot v-if="$slots.header" name="header" />
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<slot v-if="$slots['title-prefix']" name="title-prefix" />
|
<slot name="title-prefix">
|
||||||
<template v-else-if="back">
|
<template v-if="back">
|
||||||
<div
|
<div
|
||||||
class="mr-16 flex cursor-pointer items-center text-16 opacity-60 transition-all-300 hover:opacity-40"
|
class="mr-16 flex cursor-pointer items-center text-16 opacity-60 transition-all-300 hover:opacity-40"
|
||||||
@click="router.back()"
|
@click="router.back()"
|
||||||
@ -26,6 +26,8 @@
|
|||||||
<span class="ml-4">返回</span>
|
<span class="ml-4">返回</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</slot>
|
||||||
|
|
||||||
<div class="mr-12 h-16 w-4 rounded-l-2 bg-primary" />
|
<div class="mr-12 h-16 w-4 rounded-l-2 bg-primary" />
|
||||||
<h2 class="font-normal">
|
<h2 class="font-normal">
|
||||||
{{ title ?? route.meta?.title }}
|
{{ title ?? route.meta?.title }}
|
||||||
@ -39,10 +41,11 @@
|
|||||||
<slot />
|
<slot />
|
||||||
</AppCard>
|
</AppCard>
|
||||||
|
|
||||||
<slot v-if="$slots.footer" name="footer" />
|
<slot name="footer">
|
||||||
<AppCard v-else-if="showFooter" class="flex-shrink-0 py-12">
|
<AppCard v-if="showFooter" class="flex-shrink-0 py-12">
|
||||||
<TheFooter />
|
<TheFooter />
|
||||||
</AppCard>
|
</AppCard>
|
||||||
|
</slot>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<slot v-if="$slots.footer" name="footer" />
|
<slot name="footer">
|
||||||
<footer v-else-if="modalOptions.showFooter" class="flex justify-end">
|
<footer v-if="modalOptions.showFooter" class="flex justify-end">
|
||||||
<n-button v-if="modalOptions.showCancel" @click="handleCancel()">
|
<n-button v-if="modalOptions.showCancel" @click="handleCancel()">
|
||||||
{{ modalOptions.cancelText }}
|
{{ modalOptions.cancelText }}
|
||||||
</n-button>
|
</n-button>
|
||||||
@ -41,6 +41,7 @@
|
|||||||
{{ modalOptions.okText }}
|
{{ modalOptions.okText }}
|
||||||
</n-button>
|
</n-button>
|
||||||
</footer>
|
</footer>
|
||||||
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</n-card>
|
</n-card>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user