feat(menu): 新增 title 插槽, 调整 子菜单 height 为 46px

This commit is contained in:
就眠仪式
2021-10-15 01:45:35 +08:00
parent 5855bee3be
commit 991462af17
9 changed files with 62 additions and 22 deletions

View File

@@ -1,16 +1,22 @@
<template>
<dd :class="[selectKey === id ? 'layui-this' : '']" @click="selectHandle()">
<a href="javascript:void(0)">{{ title }}</a>
<a href="javascript:void(0)">
<slot v-if="slots.title" name="title"></slot>
<span v-else> {{ title }} </span>
</a>
</dd>
</template>
<script setup name="LayMenuChildItem" lang="ts">
import { defineProps, inject, Ref } from 'vue'
import { defineProps, inject, Ref, useSlots } from 'vue'
const props = defineProps<{
id: string
title: string
}>()
const slots = useSlots()
const props =
defineProps<{
id: string
title: string
}>()
const selectKey: Ref<string> = inject('selectKey') as Ref<string>

View File

@@ -5,7 +5,8 @@
:class="[isOpen && isTree ? 'layui-nav-itemed' : '']"
>
<a href="javascript:void(0)" @click="openHandle">
{{ title }}
<slot v-if="slots.title" name="title"></slot>
<span v-else>{{ title }}</span>
<i class="layui-icon layui-icon-down layui-nav-more" />
</a>
<dl
@@ -25,7 +26,10 @@
:class="[selectKey === id ? 'layui-this' : '']"
@click="selectHandle()"
>
<a href="javascript:void(0)">{{ title }} </a>
<a href="javascript:void(0)">
<slot v-if="slots.title" name="title"></slot>
<span v-else> {{ title }} </span>
</a>
</li>
</template>