Vue和Element UI 路由跳转,侧边导航的路由跳转,侧边栏拖拽

news2024/9/23 3:18:15

 首先看布局,因为我的用于页面显示的 <router-view> 是通过重定向定位到登陆页的,然后通过登陆页跳转到主页。项目中用到了点击侧边栏的跳转,所以记录下来,方便有需要的人用到~

  1. 阐述
    (1).content{ display:flex;} 一定要有,否则在拖拽时会出现换行的情况
    (2)resize 要相对于父级绝对定位

<template>
	<!--	<div class="el-dialog__header">-->

	<!--	</div>-->
	<div >
		<!--搜索框-->
		<div class="top-wrapper ">
			<div class="search el-input el-input--suffix">
				<input
					type="text"
					autocomplete="off"
					placeholder="输入指标名称搜索"
					class="el-input__inner"
				/>
			</div>
		</div>
		<!--中部-->
		<div class="indicator-wrapper">
			<!--侧边栏   -->
			<div class="indicator-side">
				<a
					:class="{ 'indicator-category': true, 'indicator-category-active': item.checked }"
					v-for="item in sideList"
					:key="item.id"
					@click.prevent="categoryClick(item)"
					href="#!"
				>
					{{ item.name }}
				</a>
			</div>
			<!--中间选择器   -->
			<div class="indicator-body">
				<div class="indicator-block"
					 v-for="item in sideList"
					 :key="item.id" :id="'chen'+ item.id">
					<div class="indicator-group">
						<span class="indicator-title">{{ item.name }} </span>
					</div>
					<div class="el-row">
						<div class="el-col el-col-8" v-for="el in item.child " :key="el.id">
							<el-checkbox v-model="el.checked" class="el-checkbox__input el-checkbox"
							><span class="el-checkbox__label">{{ el.name }}</span></el-checkbox>
						</div>
					</div>
				</div>
			</div>
			<!--拖拽-->
			<div class="flex ">
				<div class="indicator-drag">
					<div class="indicator-content">
						<div class="drag-title">已选指标</div>
						<div class="drag-sec">拖动可自定义指标顺序</div>
						<div class="indicator-limit_low">
							<div class="drag-block not-allow mg2">账户名称</div>
						</div>
						<div class="drag-sepreate">以上指标将横向固定</div>
					</div>
					<div class="indicator-limit-many" style="max-height: 445px">
						<section
							v-draggable="[
							drag,
							{
								animation: 150,
								ghostClass: 'ghost',
								group: 'people',
								onUpdate,
								onAdd,
								onRemove
							}
						]"
							class="flex flex-col gap-2 p-4 w-300px h-300px m-auto bg-gray-500/5 rounded overflow-auto"
						>
							<div
								v-for="item in drag"
								:key="item.id"
								class="drag-block hover-class all-scroll mg2"
								@click="dragClick(item)"
							>
								{{ item.name
								}}
								<el-icon
									@click="removeItem(item.id)"
									style="
									float: right;
									align-items: center;
									position: relative;
									top: 8px;
								"
									class="mg-icon-close close"
								>
									<close
									/>
								</el-icon>
							</div>
						</section>
						<div class="flex justify-between">
							<preview-list :list="drag" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { vDraggable } from "vue-draggable-plus";
import { Close } from "@element-plus/icons-vue";

const sideList = ref([
	{
		id: 1,
		name: "基本信息",
		child: [
			{
				id: 1,
				name: "账号名称"
			},
			{
				id: 2,
				name: "账户ID"
			},
			{
				id: 3,
				name: "账户主体"
			}
		]
	},
	{
		id: 2,
		name: "财务流水",
		child: [
			{
				id: 1,
				name: "共享赠款支出(¥)"
			},
			{
				id: 2,
				name: "账户总支出"
			},
			{
				id: 3,
				name: "账户现金支出"
			}
		]
	},
	{
		id: 3,
		name: "展现数据",
		child: [
			{
				id: 1,
				name: "消耗"
			},
			{
				id: 2,
				name: "展示数"
			},
			{
				id: 3,
				name: "平均千次展现费用"
			}
		]
	},
	{
		id: 4,
		name: "转化数据",
		child: [
			{
				id: 1,
				name: "转换数"
			},
			{
				id: 2,
				name: "转换陈本"
			},
			{
				id: 3,
				name: "转换率"
			}
		]
	},
	{
		id: 5,
		name: "转化数据(计费时间)",
		child: [
			{
				id: 1,
				name: "转化数(计费时间)"
			},
			{
				id: 2,
				name: "转化成本(计费时间)"
			},
			{
				id: 3,
				name: "深度转化次数(计费时间)"
			}
		]
	},
	{
		id: 6,
		name: " APP下载数据",
		child: [
			{
				id: 1,
				name: "安卓下载开始数"
			},
			{
				id: 2,
				name: "安卓下载开始成本"
			},
			{
				id: 3,
				name: "安卓下载开始率"
			}
		]
	},
	{
		id: 7,
		name: "视频数据",
		child: [
			{
				id: 1,
				name: "播放数"
			},
			{
				id: 2,
				name: "有效播放数"
			},
			{
				id: 3,
				name: "有效播放率"
			}
		]
	},
	{
		id: 8,
		name: "落地页及门店数据",
		child: [
			{
				id: 1,
				name: "点击电话按钮"
			},
			{
				id: 2,
				name: "表单提交"
			},
			{
				id: 3,
				name: "地图搜索"
			}
		]
	},
	{
		id: 9,
		name: "附加创意",
		child: [
			{
				id: 1,
				name: "附加创意电话按钮点击"
			},
			{
				id: 2,
				name: "附加创意在线咨询点击"
			},
			{
				id: 3,
				name: "附加创意表单按钮点击"
			}
		]
	},
	{
		id: 10,
		name: "互动数据",
		child: [
			{
				id: 1,
				name: "新增关注数"
			},
			{
				id: 2,
				name: "点赞数"
			},
			{
				id: 3,
				name: "评论提交数"
			}
		]
	},
	{
		id: 11,
		name: " 直播间数据",
		child: [
			{
				id: 1,
				name: "直播间观看数"
			},
			{
				id: 2,
				name: "直播间超过1分钟观看数"
			},
			{
				id: 3,
				name: "直播间关注数"
			}
		]
	},
	{
		id: 12,
		name: "游戏行业",
		child: [
			{
				id: 1,
				name: "当日付费金额"
			},
			{
				id: 2,
				name: "当日付费ROI"
			},
			{
				id: 3,
				name: "激活24h首次付费数"
			}
		]
	},
	{
		id: 13,
		name: "线索收集",
		child: [
			{
				id: 1,
				name: "有效获客"
			},
			{
				id: 2,
				name: "乘客首次下单数"
			},
			{
				id: 3,
				name: "回访—加好友(计费时间)"
			}
		]
	}
]);

const categoryClick = (item) => {
	sideList.value.forEach((el) => (el.checked = false));
	item.checked = !item.checked;
	const element = document.getElementById("chen" + item.id);
	if (element) {
		element.scrollIntoView({ behavior: "smooth" });
	}

};

const count = ref(0);

const removeItem = (id) => {
	drag.value = drag.value.filter(item => item.id != id);


};
// const domeRef = ref<HTMLElement | null>(null);
// const handleClick = (MouseEvent) => {
// 	e.preventDefault();
// };
//拖拽
const drag = ref([
	{
		id: 1,
		name: "账户ID"
	},
	{
		id: 2,
		name: "备注"
	},
	{
		id: 3,
		name: "项目"
	},
	{
		id: 4,
		name: "登录邮箱"
	},
	{
		id: 5,
		name: "账户余额(元)"
	},
	{
		id: 6,
		name: "消耗"
	},
	{
		id: 7,
		name: "点击率"
	},
	{
		id: 8,
		name: "深度转化成本"
	},
	{
		id: 9,
		name: "首次付费率"
	},
	{
		id: 10,
		name: "APP内访问"
	},
	{
		id: 11,
		name: "app内下单"
	}
]);
const dragClick = (item) => {
	drag.value.forEach((el) => (el.checked = false));
	item.checked = !item.checked;
};

function onUpdate() {
	console.log("update");
}

function onAdd() {
	console.log("add");
}

function onRemove() {
	console.log("remove");
}
</script>

<style scoped lang="scss">
::v-deep .el-scrollbar {
	overflow: hidden;
	height: 100%;
	position: static !important;
}

::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
	background-color:  #409eff;;
	//border-color: var(--el-checkbox-checked-input-border-color);
}
//隐藏滚动条
::-webkit-scrollbar-thumb {
	border-radius: 5px;
	background-color: rgb(255, 255, 255, 0.2);;
}

::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}
//搜索框
.top-wrapper {
	display: flex;
	justify-content: flex-start;
	margin-bottom: 16px;
}

.top-wrapper .search {
	width: 250px;
}

.el-input {
	position: relative;
	font-size: 14px;
}

.el-input__inner {
	-webkit-appearance: none;
	background-color: #fff;
	background-image: none;
	border-radius: 4px;
	border: 1px solid #dcdfe6;
	box-sizing: border-box;
	color: #606266;
	display: inline-block;
	height: 40px;
	line-height: 40px;
	outline: 0;
	padding: 0 15px;
	transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
	width: 100%;
	font-size: inherit;
	-webkit-transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.el-dialog .el-dialog__body .el-input .el-input__inner {
	padding-left: 8px;
	color: #333;
}

.el-input .el-input__inner {
	height: 32px;
	line-height: 32px;
	border-radius: 2px;
}

//侧边栏
.indicator-side .indicator-category {
	padding-left: 16px;
	font-size: 14px;
	line-height: 40px;
	color: #333;
	cursor: pointer;
	display: block;
}

.indicator-side .indicator-category-active {
	color: #197afb;
	background-color: #d6eaff;
}

//中间基本信息
.indicator-block {
	padding: 16px 0 0 24px;
	border-bottom: 1px solid #eaebec;
}

.indicator-group {
	display: flex;
	justify-content: flex-start;
}

.indicator-title {
	margin-bottom: 16px;
	font-weight: 700;
	color: #333;
}

.el-checkbox__input.is-checked .el-checkbox__label{
	color: #409eff;
}

.el-checkbox__label {
	color: #333;
}

.el-checkbox__label,
.el-radio__label {
	font-size: 12px;
	color: #666;
}

.el-checkbox__label {
	display: inline-block;
	padding-left: 1px;
	line-height: 19px;
	font-size: 12px;
}

//拖拽
.indicator-drag .indicator-content {
	padding: 0 16px;
}

.indicator-drag .drag-title {
	font-size: 14px;
	font-weight: 700;
	line-height: 100%;
	color: #333;
}

.indicator-drag .drag-sec {
	margin: 8px 0;
	font-size: 12px;
	line-height: 100%;
	color: #999;
}
.indicator-drag .drag-sepreate {
	position: relative;
	margin: 16px 0 0;
	font-size: 12px;
	color: #999;
	text-align: center;
}

.indicator-drag .indicator-limit-many {
	max-height: 445px;
	padding: 0 16px;
	margin-top: 16px;
	overflow-x: hidden;
	overflow-y: auto;
}


.indicator-drag .mg2 {
	margin-bottom: 2px;
}

.indicator-drag .drag-block {
	position: relative;
	height: 40px;
	//width: 134px;
	padding: 0 30px 0 36px;
	overflow: hidden;
	line-height: 40px;
	text-overflow: ellipsis;
	white-space: nowrap;
	background-color: #fff;
	border-bottom: 1px solid #e8eaec;
}


.indicator-drag .drag-block .close {
	position: absolute;
	top: 13px;
	line-height: 100%;
	color: #cecece;
	cursor: pointer;
}

//滑动条
.infinite-list {
	width: 160px;
	height: 300px;
	padding: 0;
	margin: 0;
	list-style: none;
}

.infinite-list .infinite-list-item {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding-left: 16px;
	font-size: 14px;
	background: #409eff;
	margin: 10px;
	color: #409eff;
}

.infinite-list .infinite-list-item + .list-item {
	margin-top: 10px;
}

//中部
.indicator-wrapper {
	display: flex;
	width: 832px;
	height: 516px;
	border: 1px solid #eaebec;
	border-radius: 4px;

}

//侧边栏
.indicator-side {
	flex-shrink: 0;
	width: 160px;
	overflow: auto;
	border-right: 1px solid #eaebec;
}

//选择器
.indicator-body {
	width: 672px;
	overflow: auto;
	scroll-behavior: smooth;
}

//右边
.indicator-drag {
	position: absolute;
	top: 0;
	right: 0;
	flex-shrink: 0;
	width: 216px;
	//height: 676px;
	padding: 25px 0;
	overflow: auto;
	background-color: #f8f8f9;
	border-right: 1px solid #eaebec;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1922614.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

openharmony上传图片,并获取返回路径

适用条件&#xff1a; openharmony开发 4.0 release版本&#xff0c;对应能力API10 一直不断尝试&#xff0c;一会用官方提供的上传文件&#xff0c;一会用第三方库的axios都不行&#xff0c; 一会报错‘没权限&#xff0c;一会报错’路径错误&#xff0c;还有报错‘401参数错…

探索Java网络编程精髓:UDP与TCP的实战魔法!

Java 中提供了专门的网络编程程序包 java.net&#xff0c;提供了两种通信协议&#xff1a;UDP&#xff08;数据报协议&#xff09;和 TCP&#xff08;传输控制协议&#xff09;&#xff0c;本文对两种通信协议的开发进行详细介绍。 1 UDP 介绍 UDP&#xff1a;User Datagram Pr…

压缩pdf文件的大小,pdf档怎么压缩为最小内存

在现代工作和学习中&#xff0c;pdf文件已经成为了一种不可或缺的文件格式。它跨平台、保持格式不变的优势使其在文件传输和分享中占据了重要位置。然而&#xff0c;pdf文件往往因为包含大量图像和文本而体积较大&#xff0c;这给文件的传输和存储带来了不少困扰。本文将为你介…

不会编程怎么办?量化交易不会编程可以使用吗?

量化交易使用计算机模型程序代替人工进行交易&#xff0c;一般需要投资者自己编写程序建模&#xff0c;然后回测无误之后再进行实盘交易&#xff0c;那么不会编程的投资者能使用量化软件进行量化交易吗&#xff1f; 不会编程使用量化软件有两种方法 一种是请人代写代码&#x…

Java高频面试基础知识点整理8

干货分享&#xff0c;感谢您的阅读&#xff01;背景​​​​​​高频面试题基本总结回顾&#xff08;含笔试高频算法整理&#xff09; 最全文章见&#xff1a;Java高频面试基础知识点整理 &#xff08;一&#xff09;Java基础高频知识考点 针对人员&#xff1a; 1.全部人员都…

【三维AIGC】扩散模型LDM辅助3D Gaussian重建三维场景

标题&#xff1a;《Sampling 3D Gaussian Scenes in Seconds with Latent Diffusion Models》 来源&#xff1a;Glasgow大学&#xff1b;爱丁堡大学 连接&#xff1a;https://arxiv.org/abs/2406.13099 提示&#xff1a;写完文章后&#xff0c;目录可以自动生成&#xff0c;如何…

Guava LocalCache源码分析:LocalCache生成

Guava LocalCache源码分析&#xff1a;Cache生成 版本LocalCache参数说明Cache构建过程LocalCache介绍LocalCache实例化将builder中的属性赋值到LocalCache中分段 LocalCache为guava本地缓存的解决方案&#xff0c;提供了基于容量&#xff0c;时间和引用的缓存回收方式&#xf…

Spring MVC入门3

看完这篇博客你能学到什么 理解JSON的使用理解注解PathVariable理解解注解RequestPart理解cookie和Session的基本概念理解cookie和Session的区别 如果想真正掌握&#xff0c;还需要自己勤加练习。 正文 JSON JSON概念 JSON&#xff1a;JavaScript Object Notation 【JavaS…

免费长效IP在业务场景中的深度应用解析

在数字化竞赛的跑道上&#xff0c;每一秒的都至关重要&#xff0c;而免费长效IP&#xff0c;不仅为企业减少了运营成本&#xff0c;更在数据安全与访问效率上筑起了一道坚实的保护线。然而&#xff0c;面对市场上琳琅满目的代理服务&#xff0c;如何挑选出能应对各种业务场景的…

【JAVA poi-tl-ext 富文本转word】

富文本转word 环境使用poi-tl-ext的原因富文本转word代码 环境 jdk 1.8 <dependency><groupId>io.github.draco1023</groupId><artifactId>poi-tl-ext</artifactId><version>0.4.16</version> </dependency>poi-tl-ext已经包…

ES 慢上游响应问题优化在用户体验场景中的实践

在抖音亿级日活流量的情况下&#xff0c;每天收到的用户反馈也是大量的&#xff0c;而用户反馈对于产品的发展与未来是至关重要的&#xff0c;因此用户体验管理平台&#xff08;简称VoC&#xff09;就应运而生&#xff0c;VoC 平台旨在通过技术平台化的方式&#xff0c;结合反馈…

字体反爬之自动化通过字体文件生成映射字典

1、首先找到以.ttf结尾的字体文件&#xff0c;下载下来&#xff0c;以我的字体文件sfont.ttf为例 sont.ttf下载地址https://download.csdn.net/download/lingyingdon/89534953 目前只测试了.ttf文件。如果想使用woff字体文件&#xff0c;请自行测试 2、下载分割字体文件的软件…

从汇编层看64位程序运行——参数传递的底层实现

大纲 小于等于6个参数一个参数总结 两个参数总结 三个参数总结 四个参数总结 五个参数总结 六个参数总结 大于6个参数七个参数总结 在32位系统中&#xff0c;参数的传递主要依靠栈来进行。那么64位系统上&#xff0c;是否依旧符合这个规则呢&#xff1f;答案是“不是”。64位系…

Objective-C 自定义渐变色Slider

文章目录 一、前情概要二、具体实现 一、前情概要 系统提供UISlider&#xff0c;但在开发过程中经常需要自定义&#xff0c;本次需求内容是实现一个拥有渐变色的滑动条&#xff0c;且渐变色随着手指touch的位置不同改变区域&#xff0c;类似如下 可以使用CAGradientLayer实现渐…

【Linux】Linux操作系统

Linux基本指令 os概念与定位 本节内容&#xff1a; Linux操作系统讲解 os概念与定位 操作系统&#xff08;Operating System&#xff0c;简称OS&#xff09;是管理和控制计算机硬件与软件资源的计算机程序。总的来讲&#xff0c;操作系统是一款做软硬件管理的软件。 了解操作…

springBoot(若依)集成camunda

1、下图为项目结构 2、最外层 pom引入依赖 <properties><!--camunda 标明版本&#xff0c;注意要个自己的Spring 版本匹配&#xff0c;匹配关系自行查询官网--><camunda.version>7.18.0</camunda.version> </properties> 3、common模块引入依赖 …

安卓14中Zygote初始化流程及源码分析

文章目录 日志抓取结合日志与源码分析systemServer zygote创建时序图一般应用 zygote 创建时序图向 zygote socket 发送数据时序图 本文首发地址 https://h89.cn/archives/298.html 最新更新地址 https://gitee.com/chenjim/chenjimblog 本文主要结合日志和代码看安卓 14 中 Zy…

抗量子密码算法:保障未来信息安全的新盾牌

随着量子计算的迅猛发展&#xff0c;传统加密算法正面临着前所未有的挑战。量子计算机利用量子比特的特殊性质&#xff0c;能在极短时间内破解目前广泛使用的公钥加密体系&#xff0c;如RSA、ECC等。这使得我国及全球的信息安全体系遭受严重威胁。为了应对这一挑战&#xff0c;…

知识图谱入门笔记

自学参考&#xff1a; 视频&#xff1a;斯坦福CS520 | 知识图谱 最全知识图谱综述 详解知识图谱的构建全流程 知识图谱构建&#xff08;概念&#xff0c;工具&#xff0c;实例调研&#xff09; 一、基本概念 知识图谱&#xff08;Knowledge graph&#xff09;&#xff1a;由结…

基于LSTM的局部特征提取网络算法原理

目录 一、LSTM的基本原理与结构 1. LSTM的核心结构 2. LSTM的工作原理 二、基于LSTM的局部特征提取 1. 输入处理与序列表示 2. LSTM层处理与特征提取 3. 特征提取的优势与应用 三、实现细节与注意事项 1. 数据预处理 2. 网络结构与参数选择 3. 训练策略与正则化 4.…