uniapp联动左侧导航栏分类?

html

<template>
	<view class="sidebar-container">
		<view class="sidebar">
			<view class="sidebar-header">
				Logo
			</view>
			<view class="sidebar-menu">
				<view class="sidebar-item" v-for="(item, index) in sidebarItems" :key="index"
					@click="handleSidebarItemClick(item)">
					{
  { item.title }}
				</view>
			</view>
		</view>
		<view class="main-content">
			<!-- 主要内容区域 -->
			<!-- 这里放主要内容 -->
		</view>
	</view>
</template>

js



<script>
	export default {
		data() {
			return {
				sidebarItems: [{
						title: '菜单项1'
					},
					{
						title: '菜单项2'
					},
					{
						title: '菜单项3'
					},
					{
						title: '菜单项4'
					}
				]
			};
		},
		methods: {
			handleSidebarItemClick(item) {
				// 处理侧边栏菜单项点击事件
				console.log('点击了菜单项:', item);
			}
		}
	};
</script>

css



<style>
	.sidebar-container {
		display: flex;
	}

	.sidebar {
		background-color: #f0f0f0;
		width: 200px;
	}

	.sidebar-header {
		padding: 20px;
		font-weight: bold;
		border-bottom: 1px solid #ccc;
	}

	.sidebar-menu {
		margin-top: 20px;
	}

	.sidebar-item {
		padding: 10px;
		cursor: pointer;
		transition: background-color 0.3s;
	}

	.sidebar-item:hover {
		background-color: #e0e0e0;
	}

	.main-content {
		flex: 1;
		padding: 20px;
	}
</style>

相关推荐

  1. uniapp联动左侧导航分类

    2023-12-10 23:32:01       56 阅读
  2. Uniapp自定义导航

    2023-12-10 23:32:01       57 阅读
  3. uniapp导航组件如何使用

    2023-12-10 23:32:01       56 阅读
  4. uniapp——自定义导航的封装

    2023-12-10 23:32:01       61 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-10 23:32:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-10 23:32:01       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-10 23:32:01       87 阅读
  4. Python语言-面向对象

    2023-12-10 23:32:01       96 阅读

热门阅读

  1. C语言-字符串搜索函数

    2023-12-10 23:32:01       51 阅读
  2. 利用strace探测cp命令一次拷多少字节

    2023-12-10 23:32:01       57 阅读
  3. 基于Html+腾讯云播SDK开发的m3u8播放器

    2023-12-10 23:32:01       63 阅读
  4. C++ Qt开发:使用关联容器类

    2023-12-10 23:32:01       47 阅读
  5. 【数据结构/C++】二分查找

    2023-12-10 23:32:01       61 阅读
  6. idea连接Hbase卡住,没有输出

    2023-12-10 23:32:01       56 阅读
  7. ES6中的Set

    2023-12-10 23:32:01       55 阅读
  8. LinuxBasicsForHackers笔记 --添加和删除软件

    2023-12-10 23:32:01       48 阅读
  9. Qt 通过命令行编译程序

    2023-12-10 23:32:01       60 阅读
  10. qt5图形视频框架

    2023-12-10 23:32:01       57 阅读
  11. Linux指令——scp:传输文件

    2023-12-10 23:32:01       57 阅读
  12. kafka

    2023-12-10 23:32:01       59 阅读
  13. LeetCode 76. 最小覆盖子串 滑动窗口框架

    2023-12-10 23:32:01       58 阅读
  14. python函数

    2023-12-10 23:32:01       67 阅读