尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

vxe-tree 树组件拖拽排序功能的使用教程

vxe-tree 树组件拖拽排序功能的使用教程
📅 发布时间:2026/6/22 10:15:57

vxe-tree 树组件拖拽排序功能的使用教程,通过 drag 启用行拖拽排序功能,支持同层级、跨层级、拖拽到子级非常强大的拖拽功能等

官网:https://vxeui.com
github:https://github.com/x-extends/vxe-pc-ui
gitee:https://gitee.com/x-extends/vxe-pc-ui

同层级拖拽

通过 drag-config.isPeerDrag 启用同层级拖拽

image

<template><div><vxe-tree v-bind="treeOptions"></vxe-tree></div>
</template><script setup>
import { reactive } from 'vue'const treeOptions = reactive({transform: true,drag: true,dragConfig: {isPeerDrag: true},data: [{ title: '节点2', id: '2', parentId: null },{ title: '节点3', id: '3', parentId: null },{ title: '节点3-1', id: '31', parentId: '3' },{ title: '节点3-2', id: '32', parentId: '3' },{ title: '节点3-2-1', id: '321', parentId: '32' },{ title: '节点3-2-2', id: '322', parentId: '32' },{ title: '节点3-3', id: '33', parentId: '3' },{ title: '节点3-3-1', id: '331', parentId: '33' },{ title: '节点3-3-2', id: '332', parentId: '33' },{ title: '节点3-3-3', id: '333', parentId: '33' },{ title: '节点3-4', id: '34', parentId: '3' },{ title: '节点4', id: '4', parentId: null },{ title: '节点4-1', id: '41', parentId: '4' },{ title: '节点4-1-1', id: '411', parentId: '42' },{ title: '节点4-1-2', id: '412', parentId: '42' },{ title: '节点4-2', id: '42', parentId: '4' },{ title: '节点4-3', id: '43', parentId: '4' },{ title: '节点4-3-1', id: '431', parentId: '43' },{ title: '节点4-3-2', id: '432', parentId: '43' },{ title: '节点5', id: '5', parentId: null }]
})
</script>

跨层级拖拽

通过 drag-config.isCrossDrag 启用跨层级拖拽

tree_drag_coss_drag

<template><div><vxe-tree v-bind="treeOptions"></vxe-tree></div>
</template><script setup>
import { reactive } from 'vue'const treeOptions = reactive({transform: true,drag: true,dragConfig: {isCrossDrag: true},data: [{ title: '节点2', id: '2', parentId: null },{ title: '节点3', id: '3', parentId: null },{ title: '节点3-1', id: '31', parentId: '3' },{ title: '节点3-2', id: '32', parentId: '3' },{ title: '节点3-2-1', id: '321', parentId: '32' },{ title: '节点3-2-2', id: '322', parentId: '32' },{ title: '节点3-3', id: '33', parentId: '3' },{ title: '节点3-3-1', id: '331', parentId: '33' },{ title: '节点3-3-2', id: '332', parentId: '33' },{ title: '节点3-3-3', id: '333', parentId: '33' },{ title: '节点3-4', id: '34', parentId: '3' },{ title: '节点4', id: '4', parentId: null },{ title: '节点4-1', id: '41', parentId: '4' },{ title: '节点4-1-1', id: '411', parentId: '42' },{ title: '节点4-1-2', id: '412', parentId: '42' },{ title: '节点4-2', id: '42', parentId: '4' },{ title: '节点4-3', id: '43', parentId: '4' },{ title: '节点4-3-1', id: '431', parentId: '43' },{ title: '节点4-3-2', id: '432', parentId: '43' },{ title: '节点5', id: '5', parentId: null }]
})
</script>

https://gitee.com/x-extends/vxe-pc-ui

相关新闻

  • 2025年五大广州新能源汽修培训学校排行榜,短期新能源汽修学 - myqiye
  • 2025年赣州口碑不错的宴席酒店、信誉高的乔迁宴席酒推荐 - 工业品牌热点
  • 避坑指南:2025年靠谱汽车托运公司排行,目前好评多的汽车托运平台综合实力与口碑权威评选 - 品牌推荐师

最新新闻

  • LLM响应质量与提示词语气关联性研究:多模型多语言实证分析
  • 多模态大模型在体育裁判中的应用:能力、挑战与技术实现路径
  • 软件测试实战:Selenium、JMeter、Postman工具链融合与项目级流程解析
  • Codex底层认知五基石:Thread、Plan Mode、Skills、Agent与Context Window
  • AgentV-RL:用智能体验证器破解强化学习奖励设计难题
  • FCPO算法:轻量级混合群智能策略破解昂贵黑箱优化难题

日新闻

  • 2026速览惠州叛逆青少年学校前十大排名名单出炉 - 武汉中职最新信息发布
  • 2026上饶白蚁消杀哪家好?15年本土2大权威白蚁防治公司推荐(金盾虫控/青蚁卫士) - 我叫一
  • 天龙八部单机版终极数据管理工具:5个技巧快速掌握游戏数据编辑

周新闻

  • Visual C++运行库修复终极指南:5分钟快速解决Windows软件启动错误
  • 手把手教你构建统计局地区经济数据爬虫:从环境搭建到数据持久化全指南
  • 2026多Agent深度解析:用AI团队替代单一模型,四种架构实战落地

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号