[新增] menu 菜单组件
This commit is contained in:
@@ -45,6 +45,7 @@ import LayScroll from './module/scroll/index'
|
||||
import LayEmpty from './module/empty/index'
|
||||
import LayFormItem from './module/formItem/index'
|
||||
import LayRate from './module/rate/index'
|
||||
import LayDropdown from './module/dropdown/index'
|
||||
|
||||
const components: Record<string, IDefineComponent> = {
|
||||
LayRadio,
|
||||
@@ -88,7 +89,8 @@ const components: Record<string, IDefineComponent> = {
|
||||
LaySelectOption,
|
||||
LayEmpty,
|
||||
LayFormItem,
|
||||
LayRate
|
||||
LayRate,
|
||||
LayDropdown
|
||||
}
|
||||
|
||||
const install = (app: App, options?: InstallOptions): void => {
|
||||
@@ -146,6 +148,7 @@ export {
|
||||
LayEmpty,
|
||||
LayFormItem,
|
||||
LayRate,
|
||||
LayDropdown,
|
||||
install,
|
||||
}
|
||||
|
||||
|
||||
9
src/module/dropdown/index.ts
Normal file
9
src/module/dropdown/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from 'vue'
|
||||
import Component from './index.vue'
|
||||
import type { IDefineComponent } from '../type/index'
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || 'LayDropdown', Component)
|
||||
}
|
||||
|
||||
export default Component as IDefineComponent
|
||||
7
src/module/dropdown/index.vue
Normal file
7
src/module/dropdown/index.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<div>下拉菜单</div>
|
||||
</template>
|
||||
|
||||
<script setup name="LayDropdown" lang="ts">
|
||||
|
||||
</script>
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<li class="layui-nav-item">
|
||||
<a href="">{{ title }} </a>
|
||||
<a href="javascript:void(0)">{{ title }} </a>
|
||||
</li>
|
||||
|
||||
<li class="layui-nav-item" v-if="slots.default">
|
||||
<a href="">
|
||||
<li class="layui-nav-item" :class="[isOpen?'layui-nav-itemed':'']" v-if="slots.default">
|
||||
<a href="javascript:void(0)" @click="openHandle">
|
||||
{{ title }}
|
||||
<i class="layui-icon layui-icon-down layui-nav-more"></i>
|
||||
</a>
|
||||
@@ -15,11 +15,18 @@
|
||||
</template>
|
||||
|
||||
<script setup name="LayMenuItem" lang="ts">
|
||||
import { defineProps, useSlots } from 'vue'
|
||||
import { defineProps, ref, useSlots } from 'vue'
|
||||
const slots = useSlots()
|
||||
|
||||
const props =
|
||||
defineProps<{
|
||||
title: string
|
||||
}>()
|
||||
}>()
|
||||
|
||||
const isOpen = ref(false)
|
||||
|
||||
const openHandle = function() {
|
||||
isOpen.value = !isOpen.value
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user