更新记录
1.0.1.2(2025-12-13)
增加说明
1.0.1(2025-12-12)
支持自定义背景
1.0.0(2025-12-12)
第一次提交
查看更多平台兼容性
uni-app(4.0)
| Vue2 | Vue2插件版本 | Vue3 | Vue2插件版本 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|---|---|
| √ | 1.0.0 | √ | 1.0.0 | - | - | - | - | - | - | - |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - | - | - | - | - |
侧栏菜单组件
Props 参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| list | Array | [] | 菜单数据数组 |
| labelKey | String | 'label' | 菜单项显示文本的键名 |
| valueKey | String | 'value' | 菜单项值的键名 |
| showRightHeader | Boolean | true | 是否显示右侧头部区域 |
| leftbg | String | '#eee' | 左侧菜单背景色 |
| rightbg | String | '#fff' | 右侧内容区域背景色 |
示例用法
<script setup>
const menuList = [
{
id: 1,
name: '菜单1',
children: [
{ id: 11, name: '子菜单1-1' },
{ id: 12, name: '子菜单1-2' }
]
},
{
id: 2,
name: '菜单2',
children: [
{ id: 21, name: '子菜单2-1' },
{ id: 22, name: '子菜单2-2' }
]
}
]
</script>
<template>
<wy-side-menu :list="menuList" label-key="name" value-key="id">
<!-- 左侧菜单插槽 -->
<template #left="{ item }">
<text>{{ item.name }}</text>
</template>
<!-- 右侧内容插槽 -->
<template #right="{ data }">
<view v-for="subItem in data.children" :key="subItem.id" class="content-item">
{{ subItem.name }}
</view>
</template>
</wy-side-menu>
</template>
插槽说明
| 插槽名 | 参数 | 说明 |
|---|---|---|
| left | { item } | 左侧菜单自定义内容 |
| leftfooter | - | 左侧菜单底部自定义内容 |
| title | { item } | 右侧头部自定义内容 |
| right | { data } | 右侧内容自定义区域 |
| empty-right | - | 右侧内容为空时的占位符 |
事件说明
组件内部通过点击左侧菜单或滚动右侧内容来切换当前选中的菜单项,无需额外绑定事件。

收藏人数:
购买源码授权版(
试用
赞赏(0)
下载 1
赞赏 0
下载 12050667
赞赏 1826
赞赏
京公网安备:11010802035340号