网站建设g/百度2022第三季度财报
前言
因为公司业务开发需要拖拽功能。
ps:该功能只能针对高度一致的,如果高度不一致需要另外二开
演示
开始
<template><view style="height: 100%;"><movable-area :style="{'width': '100%', 'height': allHeight + 'px'}"><movable-viewv-for="(item, index) in list":key="item.id":x="0":y="item.y":style="{'height': itemHeight + 'px', 'width': '100%',}"direction="all"@touchstart="handleDragStart(index)"@change="handleMoving(index, $event)"@touchend="handleDragEnd"class="movable-view"><!-- 这里可以放置步骤的详细内容 --><view style="background-color: aqua; padding: 20rpx 0;">{{ item.desc }}</view></movable-view></movable-area></view>
</template><script>
export default {data() {return {list: [],cloneList: [],activeIndex: -1, // 选中oldIndex: -1,moveToIndex: -1, // 移动allHeight: 300,itemHeight: 50};},created() {for(let i = 0; i < 12; i ++) {let info = {id: i,desc: '测试' + i}this.list.push(info)}this.allHeight = 12 * this.itemHeightthis.initList(this.list)},methods: {deepCopy(source) {return JSON.parse(JSON.stringify(source));},initList(list=[]){const newList = this.deepCopy(list);this.list = newList.map((item, index) => {return {...item,y: index * this.itemHeight,key: Math.random() + index};});//拷贝一份初始list值this.cloneList = this.deepCopy(this.list);},// 拖拽开始handleDragStart(index) {this.activeIndex = index;this.oldIndex = index;},handleMoving(index, e){if (e.detail.source !== 'touch') return;const { x, y } = e.detail;const currentY = Math.floor((y + this.itemHeight / 2) / this.itemHeight);this.moveToIndex = Math.min(currentY, this.list.length - 1);//更新移动后的位置if (this.oldIndex !== this.moveToIndex && this.oldIndex !== -1 && this.moveToIndex !== -1) {const newList = this.deepCopy(this.cloneList);//交换位置newList.splice(this.moveToIndex, 0, ...newList.splice(this.activeIndex, 1));this.list.forEach((item, index) => {if (index !== this.activeIndex) {const itemIndex = newList.findIndex(val => val.id === item.id);item.y = itemIndex*this.itemHeight}});this.oldIndex = this.moveToIndex;}},handleDragEnd(e) {if (this.moveToIndex !== -1 && this.activeIndex !== -1 && this.moveToIndex !== this.activeIndex) {this.cloneList.splice(this.moveToIndex, 0, ...this.cloneList.splice(this.activeIndex, 1));}// 重新排序下更新后的位置。this.initList(this.cloneList);this.activeIndex = -1;this.oldIndex = -1;this.moveToIndex = -1;},},
};
</script><style>
.movable-area {}.movable-view {}
</style>
相关文章:

uniapp结合movable-area与movable-view实现拖拽功能
前言 因为公司业务开发需要拖拽功能。 ps:该功能只能针对高度一致的,如果高度不一致需要另外二开 演示 开始 <template><view style"height: 100%;"><movable-area :style"{width: 100%, height: allHeight px}"…...

十九(GIT2)、token、黑马就业数据平台(页面访问控制(token)、首页统计数据、登录状态失效)、axios请求及响应拦截器、Git远程仓库
1. JWT介绍 JSON Web Token 是目前最为流行的跨域认证解决方案,本质就是一个包含信息的字符串。 如何获取:在使用 JWT 身份验证中,当用户使用其凭据成功登录时,将返回 JSON Web Token(令牌)。 作用…...

文生图模型开源之光!ComfyUI - AuraFlow本地部署教程
一、模型介绍 AuraFlow 是唯一一个真正开源的文生图模型,由Fal团队开源,其代码和权重都放在了 FOSS 许可证下。基于 6.8B 参数优化模型架构,采用最大更新参数化技术,还重新标注数据集提升指令遵循质量。在物体空间和色彩上有优势…...

spring boot之@Import注解的应用
我们知道spring boot会通过ComponentScan定义包扫描路径进行业务定义的bean的加载,但是对于很多不在此包路径下定义的bean怎么办呢?比如其他jar包中定义的。这时候import就发挥作用了,通过它也可以实现bean的定义。具体是怎么做的呢ÿ…...

【记录】用JUnit 4的@Test注解时报错java.lang.NullPointerException的原因与解决方法
项目场景: 在练习黑马点评的逻辑过期解决缓存击穿时,编写了一个预热缓存数据的单元测试 SpringBootTest public class HmDianPingApplicationTests {Resourceprivate ShopServiceImpl shopService;Testpublic void testSaveShop() throws InterruptedE…...

Spring Boot 自动化脚本-多线程批量压缩图片
Spring Boot 自动化脚本-多线程批量压缩图片 支持多线程支持多路径配置支持断点续压支持压缩后文件层级路径不变脚本一键启动,支持本地 main 调用或远程 POST 接口调用 背景:在进行数据迁移时,发现附件文件夹过于庞大,且大都为图…...

依托 Spring Boot框架,精铸高扩展性招聘信息管控系统
1 绪 论 1.1 课题背景与意义 在Internet高速发展的今天,计算机的应用几乎完全覆盖我们生活的各个领域,互联网在经济,生活等方面有着举足轻重的地位,成为人们资源共享,信息快速传递的重要渠道。在中国,网上管…...

【前端】理解 JavaScript 对象属性访问的复杂性
博客主页: [小ᶻ☡꙳ᵃⁱᵍᶜ꙳] 本文专栏: 前端 文章目录 💯前言💯理论基础:JavaScript 对象属性的访问模式1. 点符号访问(Dot Notation)2. 方括号访问(Bracket Notation)点符号…...

Django异步视图adrf解决办法
提问 在Django编写异步视图的时候会出现 AssertionError: Expected a Response, HttpResponse or HttpStreamingResponse to be returned from the view 或者 TypeError: sync_to_async can only be applied to sync functions. 诸如此类的错误的时候一般发生在异步视图中…...

【一文了解】C#基础-接口
目录 1. 定义 2. 接口的特点与规则 3. 接口的实现 3.1单接口实现 3.2多接口实现 4. 接口的作用和用途 1)扩展行为 2)规范行为 3)降低耦合 5. 接口与继承的比较 1)继承 2)接口 6. 接口与抽象类的比较 1)IComparable(比较器,常用) 2)IComparer(比较器)…...

活着就好20241210
亲爱的朋友们,大家早上好!🌞 今天是10号,星期二,2024年12月的第十天,同时也是第50周的开始,农历甲辰[龙]年十一月初六日。在这晨光熹微的美好时刻,愿那温暖而明媚的阳光轻轻拂过你的…...

多表设计 - 一对一多对多
一.一对一关系概述: 例如:一位用户只能有一张身份证,一张身份证也只能对应一位用户 如果用户基本信息查询频率比用户身份信息查询频率高,为了提高效率,可拆分为两张表: 此时如何体现一对一的关系呢…...

实现 DataGridView 下拉列表功能(C# WinForms)
本文介绍如何在 WinForms 中使用 DataGridViewComboBoxColumn 实现下拉列表功能,并通过事件响应来处理用户的选择。以下是实现步骤和示例代码。 1. 效果展示 该程序的主要功能是展示如何在 DataGridView 中插入下拉列表,并在选择某一项时触发事件。 2.…...

使用Java创建RabbitMQ消息生产者的详细指南
目录 在现代分布式系统中,消息队列是实现异步通信的重要工具。RabbitMQ作为一种流行的开源消息代理,支持多种消息协议,广泛应用于微服务架构和事件驱动的应用程序中。本文将深入探讨如何使用Java创建RabbitMQ的消息生产者,发送消息…...

【LC】160. 相交链表
题目描述: 给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回 null 。 图示两个链表在节点 c1 开始相交: 题目数据 保证 整个链式结构中不存在环。 注意&…...

Spark架构及运行流程
Spark架构图 Driver: 解析用户的应用程序代码,转化为作业(job)。创建SparkContext上下文对象,其负责与资源管理器(ClusterManager)通信,进行资源的申请、任务的分配和监控等。跟踪Executor的执行情况。可通过UI界面查询运行情况。…...

Linux安装Python2.7.5(centos自带同款)
卸载已安装的python,防止版本兼容问题 rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps 删除残余文件 whereis python |xargs rm -frv 安装前提是已安装gcc和g gcc --version g --version 下载安装python2.7.5 https://www.python.org/downloads/release/pyt…...

上传ssh公钥到目标服务器
创建密钥 ssh-keygen -t rsa -b 4096 -C "xxxx.xx"上传 sudo ssh-copy-id -i /Users/xx/.ssh/id_rsa.pub root127.0.0.1...

【LLMs】用LM Studio本地部署离线大语言模型
文章目录 一、下载LM Studio二、下载大语言模型1. 查看模型介绍2. 点击模型文件进行下载2.1 完整下载2.2 部分下载 三、加载模型1. 打开LM Studio图形化界面,点击**My Models**2. 然后,点击“...”,选择“change”,选择刚下载好的…...

SpringBoot下类加入容器的几种方式
SpringBoot下类加入容器的几种方式 在 Spring Boot 中,类加入容器的方式不仅多样,而且每种方式都有其特定的使用场景。以下是几种常见的将类加入 Spring 容器的方法及其适用场景: 1. 使用 Component 及其派生注解 使用场景:当开…...

【Mysql】忘记Root密码后如何不影响数据进行重置密码
方法一:通用方法--启动时跳过权限表 1> 停止数据库 以管理员方式打开cmd!! C:\Users\Administrator>net stop mysql MySQL 服务正在停止.. MySQL 服务已成功停止。 2> 启动时跳过权限表 mysqld --console --skip-grant-tables -…...

宝塔内设置redis后,项目以及RedisDesktopManager客户端连接不上!
项目展现问题: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to xxx.宝塔外链.ip.xxxx:6379 redis客户端连接失败: 1、宝塔中确认redis端口已放行 2、修改redis的配置 bind&#x…...

一文了解模式识别顶会ICPR 2024的研究热点与最新趋势
简介 对模式识别研究领域前沿方向的跟踪是提高科研能力和制定科研战略的关键。本文通过图文并茂的方式介绍了ICPR 2024的研究热点与最新趋势,帮助读者了解和跟踪模式识别的前沿研究方向。本推文的作者是黄星宇,审校为邱雪和许东舟。 一、会议介绍 ICPR…...

【深度学习】深刻理解BERT
BERT(Bidirectional Encoder Representations from Transformers)是由Google于2018年提出的一种预训练的语言表示模型,它基于Transformer架构并能够处理自然语言处理(NLP)中的多种任务。BERT的核心创新是其使用了双向编…...

一种基于通义千问prompt辅助+Qwen2.5-coder-32b+Bolt.new+v0+Cursor的无代码对话网站构建方法
前言 今年似乎大模型之间的“内卷”已经有些偃旗息鼓了,各大技术公司逐渐从单纯追求模型参数量的竞赛中抽身,转向更加注重模型的实际应用效果与效率,开始内卷起了LLM“载具” 不知道这个词是不是我第一个发明的哈,总之我更喜欢…...

Java版-图论-最小生成树-Kruskal算法
实现描述 为了造出一棵最小生成树,我们从最小边权的边开始,按边权从小到大依次加入,如果某次加边产生了环,就扔掉这条边,直到加入了 n-1 条边,即形成了一棵树。 实现代码 首选我们对所有的边,…...

计算机网络知识总结
1.网络协议是什么? 在计算机网络要做到有条不紊地交换数据,就必须遵守一些约定好的规则,比如交换数据地格式,是否需要发送一个应答信息。这些规则被称为网络协议。 分层结构 应用层:为计算机用户提供服务表示层&…...

普通算法——欧拉筛
欧拉筛 思路: 对欧拉筛的实现,主要是依靠一个数组模拟的栈来实现,核心思路为用栈储存已经发现的素数 在之后的遍历中,即可以素数数组中的数为因数来筛出此素数的倍数 遍历是以当前的 i i i 值为基数,来乘当前素数数…...

【知识科普】DNS(域名解析服务)深入解读
文章目录 概述一、基本概念二、域名解析的原理三、域名解析的类型四、域名解析的常见问题及解决方法五、域名解析的重要性 部署一、准备环境二、安装DNS软件三、配置DNS服务器四、测试DNS解析五、维护和管理DNS服务器 配置文件一、BIND DNS服务器配置文件格式二、Windows系统DN…...

数据结构第一弹-数据结构在不同领域的应用
大家好,今天和大家一起总结一下数据结构在不同领域和场景的应用~ 不同的数据结构适用于解决不同类型的问题,从简单的数组到复杂的图结构,每种数据结构都有其独特的应用场景。 1. 数组与链表 1.1 概念 数组:一种线性数据结构&a…...