2021-12-30 00:44:43 +08:00
|
|
|
::: anchor
|
|
|
|
:::
|
|
|
|
|
2022-02-06 05:20:07 +08:00
|
|
|
::: title 基本介绍
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: describe 导航菜单是一个网站的灵魂,用户依赖导航在各个页面中进行跳转。
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 基础使用
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-09-29 23:42:53 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-02-24 17:56:05 +08:00
|
|
|
<lay-menu v-model:selectedKey="selectedKey" v-model:openKeys="openKeys1">
|
2022-02-27 12:55:09 +08:00
|
|
|
<lay-menu-item id="1">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="2">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="3">首页</lay-menu-item>
|
|
|
|
<lay-sub-menu id="7">
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">首页</lay-menu-item>
|
|
|
|
<lay-sub-menu title="菜单" id="10">
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="11">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="12">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="13">首页</lay-menu-item>
|
2022-01-05 14:56:16 +08:00
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
2021-09-29 23:42:53 +08:00
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-18 16:43:49 +08:00
|
|
|
const selectedKey = ref("5")
|
2022-02-24 17:56:05 +08:00
|
|
|
const openKeys1 = ref(["7"])
|
2021-09-29 23:42:53 +08:00
|
|
|
return {
|
2021-10-18 16:43:49 +08:00
|
|
|
selectedKey,
|
2022-02-24 17:56:05 +08:00
|
|
|
openKeys1
|
2021-09-29 23:42:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
2021-10-01 18:20:41 +08:00
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 垂直导航
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-01 18:20:41 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-02-24 17:56:05 +08:00
|
|
|
<lay-menu v-model:selectedKey="selectedKey" v-model:openKeys="openKeys2" :tree="true">
|
2022-02-27 12:55:09 +08:00
|
|
|
<lay-menu-item id="1">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="2">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="3">首页</lay-menu-item>
|
|
|
|
<lay-sub-menu id="7">
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">首页</lay-menu-item>
|
2022-01-30 21:50:38 +08:00
|
|
|
<lay-sub-menu title="菜单" id="10">
|
2022-02-27 12:55:09 +08:00
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="11">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="12">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="13">首页</lay-menu-item>
|
2022-01-05 14:56:16 +08:00
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2022-02-24 17:56:05 +08:00
|
|
|
const openKeys2 = ref(["7"])
|
2022-01-09 22:11:28 +08:00
|
|
|
const selectedKey = ref("5")
|
2022-01-05 14:56:16 +08:00
|
|
|
|
|
|
|
return {
|
2022-02-24 17:56:05 +08:00
|
|
|
openKeys2,
|
2022-01-05 14:56:16 +08:00
|
|
|
selectedKey
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-01-30 20:29:16 +08:00
|
|
|
::: title 反转样式
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-02-24 17:56:05 +08:00
|
|
|
<lay-menu level="true" v-model:selectedKey="selectedKey" inverted="true" v-model:openKeys="openKeys3" :tree="true">
|
2022-02-27 12:55:09 +08:00
|
|
|
<lay-menu-item id="1">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="2">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="3">首页</lay-menu-item>
|
|
|
|
<lay-sub-menu id="7">
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">首页</lay-menu-item>
|
|
|
|
<lay-sub-menu id="10">
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="11">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="12">首页</lay-menu-item>
|
|
|
|
<lay-menu-item id="13">首页</lay-menu-item>
|
2022-01-30 20:29:16 +08:00
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2022-02-24 17:56:05 +08:00
|
|
|
const openKeys3 = ref(["7"])
|
2022-01-30 20:29:16 +08:00
|
|
|
const selectedKey = ref("5")
|
|
|
|
|
|
|
|
return {
|
2022-02-24 17:56:05 +08:00
|
|
|
openKeys3,
|
2022-01-30 20:29:16 +08:00
|
|
|
selectedKey
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-01-30 00:04:36 +08:00
|
|
|
::: title 切换主题
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-02-24 17:56:05 +08:00
|
|
|
<lay-menu v-model:selectedKey="selectedKey" theme="light" v-model:openKeys="openKeys4" :tree="true">
|
2022-02-27 12:55:09 +08:00
|
|
|
<lay-menu-item id="1">
|
|
|
|
<template #title>
|
|
|
|
菜单
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="2">
|
|
|
|
<template #title>
|
|
|
|
菜单
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="3">
|
|
|
|
<template #title>
|
|
|
|
菜单
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-sub-menu id="7">
|
|
|
|
<template #title>
|
|
|
|
目录
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">
|
|
|
|
菜单
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">
|
|
|
|
菜单
|
|
|
|
</lay-menu-item>
|
2022-01-30 21:50:38 +08:00
|
|
|
<lay-sub-menu title="菜单" id="10">
|
2022-02-27 12:55:09 +08:00
|
|
|
<template #title>
|
|
|
|
目录
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="11">
|
|
|
|
菜单
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="12">
|
|
|
|
菜单
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="13">
|
|
|
|
菜单
|
|
|
|
</lay-menu-item>
|
2022-01-30 00:04:36 +08:00
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2022-02-24 17:56:05 +08:00
|
|
|
const openKeys4 = ref(["7"])
|
2022-01-30 00:04:36 +08:00
|
|
|
const selectedKey = ref("5")
|
|
|
|
|
|
|
|
return {
|
2022-02-24 17:56:05 +08:00
|
|
|
openKeys4,
|
2022-01-30 00:04:36 +08:00
|
|
|
selectedKey
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-01-05 14:56:16 +08:00
|
|
|
::: title 菜单插槽
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-02-24 17:56:05 +08:00
|
|
|
<lay-menu v-model:selectedKey="selectedKey" v-model:openKeys="openKeys5" v-model:tree="isTree">
|
2022-01-05 14:56:16 +08:00
|
|
|
<lay-menu-item id="1">
|
2022-02-02 03:27:34 +08:00
|
|
|
<router-link to="">
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
首页
|
|
|
|
</router-link>
|
2022-01-05 14:56:16 +08:00
|
|
|
</lay-menu-item>
|
2022-01-09 22:11:28 +08:00
|
|
|
<lay-sub-menu id="7">
|
2022-01-05 14:56:16 +08:00
|
|
|
<template v-slot:title>
|
2022-02-02 03:27:34 +08:00
|
|
|
<router-link to="">
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
目录
|
|
|
|
</router-link>
|
2022-01-05 14:56:16 +08:00
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">
|
2022-02-02 03:27:34 +08:00
|
|
|
<router-link to="">
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
菜单
|
|
|
|
</router-link>
|
2022-01-05 14:56:16 +08:00
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">
|
2022-02-02 03:27:34 +08:00
|
|
|
<router-link to="">
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
菜单
|
|
|
|
</router-link>
|
2022-01-02 22:49:12 +08:00
|
|
|
</lay-menu-item>
|
2022-01-09 22:11:28 +08:00
|
|
|
</lay-sub-menu>
|
2021-10-01 18:20:41 +08:00
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-15 14:57:48 +08:00
|
|
|
const isTree = ref(true)
|
2021-10-17 01:18:42 +08:00
|
|
|
const selectedKey = ref("5")
|
2022-02-24 17:56:05 +08:00
|
|
|
const openKeys5 = ref(["7"])
|
2021-10-15 14:57:48 +08:00
|
|
|
|
2021-10-01 18:20:41 +08:00
|
|
|
return {
|
2021-10-17 01:18:42 +08:00
|
|
|
isTree,
|
2022-02-24 17:56:05 +08:00
|
|
|
openKeys5,
|
2021-10-17 01:18:42 +08:00
|
|
|
selectedKey
|
2021-10-01 18:20:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
2021-10-09 10:41:52 +08:00
|
|
|
|
2022-02-25 10:10:33 +08:00
|
|
|
::: title 菜单折叠
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-switch v-model="collapse"></lay-switch>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
<lay-menu v-model:selectedKey="selectedKey" v-model:tree="isTree" v-model:openKeys="openKeys6" :collapse="collapse">
|
2022-02-27 12:55:09 +08:00
|
|
|
<lay-menu-item id="1">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="2">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="3">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
2022-02-25 10:10:33 +08:00
|
|
|
<lay-sub-menu title="目录" id="7">
|
2022-02-27 12:55:09 +08:00
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="8">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="9">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-sub-menu id="10">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="11">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="12">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-sub-menu id="13">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
<lay-menu-item id="14">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="15">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
|
|
|
<lay-menu-item id="16">
|
|
|
|
<template #icon>
|
|
|
|
<lay-icon type="layui-icon-home"></lay-icon>
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
首页
|
|
|
|
</template>
|
|
|
|
</lay-menu-item>
|
2022-02-25 10:10:33 +08:00
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-sub-menu>
|
|
|
|
</lay-menu>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
|
|
|
const selectedKey = ref("5")
|
|
|
|
const openKeys6 = ref(["7"])
|
|
|
|
const collapse = ref(true)
|
|
|
|
const isTree = ref(true)
|
|
|
|
return {
|
|
|
|
selectedKey,
|
|
|
|
openKeys6,
|
|
|
|
colapse,
|
|
|
|
isTree
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-01-09 22:11:28 +08:00
|
|
|
::: title Menu 属性
|
2021-10-13 10:04:43 +08:00
|
|
|
:::
|
2021-10-12 18:00:09 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2022-02-27 12:55:09 +08:00
|
|
|
| 属性 | 描述 | 备注 |
|
|
|
|
| ------------------- | -------------- | -------------- |
|
|
|
|
| v-model:selectedKey | 选中项 | -- |
|
|
|
|
| v-model:openKeys | 打开项 | -- |
|
|
|
|
| theme | 菜单主题 | `dark` `light` |
|
|
|
|
| inverted | 特殊的激活样式 | `true` `false` |
|
|
|
|
| level | 菜单层级 | `true` `false` |
|
2022-03-25 18:16:23 +08:00
|
|
|
| collapse | 折叠状态 | `true` `false` |
|
|
|
|
| collapse-transition | 折叠动画 | `true` `false` |
|
2021-11-07 15:55:08 +08:00
|
|
|
|
|
|
|
:::
|
2021-10-15 09:30:37 +08:00
|
|
|
|
2022-01-09 22:11:28 +08:00
|
|
|
::: title Menu Item 属性
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: table
|
|
|
|
|
|
|
|
| 插槽 | 描述 | 备注 |
|
|
|
|
| ----- | -------- | ---- |
|
|
|
|
| title | 菜单标题 | -- |
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: title Menu Item 插槽
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: table
|
|
|
|
|
|
|
|
| 插槽 | 描述 | 备注 |
|
|
|
|
| ----- | -------- | ---- |
|
|
|
|
| title | 菜单标题 | -- |
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: title Sub Menu 属性
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: table
|
|
|
|
|
|
|
|
| 插槽 | 描述 | 备注 |
|
|
|
|
| ----- | -------- | ---- |
|
|
|
|
| title | 菜单标题 | -- |
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: title Sub Menu 插槽
|
2021-10-15 09:30:37 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 插槽 | 描述 | 备注 |
|
|
|
|
| ----- | -------- | ---- |
|
|
|
|
| title | 菜单标题 | -- |
|
2021-11-07 15:55:08 +08:00
|
|
|
|
2021-11-07 15:56:24 +08:00
|
|
|
:::
|
2021-12-16 17:57:59 +08:00
|
|
|
|
|
|
|
::: comment
|
2022-01-12 14:19:06 +08:00
|
|
|
:::
|
|
|
|
|
|
|
|
::: previousNext nav
|
2022-01-30 20:37:33 +08:00
|
|
|
:::
|