feat(menu): 新增 title 插槽, 调整 子菜单 height 为 46px
This commit is contained in:
@@ -4802,8 +4802,8 @@ body .layui-table-tips .layui-layer-content {
|
||||
|
||||
.layui-nav-tree .layui-nav-item a {
|
||||
position: relative;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user