1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-05-01 14:49:00 +08:00

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

This commit is contained in:
leipu 2024-11-13 10:48:58 +08:00
parent 2b36f535c7
commit fa0219ef99

View File

@ -16,16 +16,18 @@
<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()"
> >
<i class="i-material-symbols:arrow-left-alt" /> <i class="i-material-symbols:arrow-left-alt" />
<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 }}