废除 menu-children-item 组件, 菜单初步支持无限极

This commit is contained in:
就眠儀式
2022-01-02 22:49:12 +08:00
parent 6d0ecc7f74
commit 923e16a5d7
5 changed files with 35 additions and 45 deletions

View File

@@ -1,9 +0,0 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayMenuChildItem", Component);
};
export default Component as IDefineComponent;

View File

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