当前位置: 首页 > wzjs >正文

做网站项目需求分析是什么线上营销方案

做网站项目需求分析是什么,线上营销方案,电商网站商品表设计,包装设计效果图完美解决ElementUI中树形结构table勾选问题 实现功能效果图全选取消全选取消父节点取消某个子节点 关键代码 实现功能 1. 全选/取消全选,更新所有节点勾选状态 2. 勾选父/子节点,子/父节点状态和全选框状态更新 效果图 全选 取消全选 取消父节点 取消某…

完美解决ElementUI中树形结构table勾选问题

  • 实现功能
  • 效果图
    • 全选
    • 取消全选
    • 取消父节点
    • 取消某个子节点
  • 关键代码

实现功能

1. 全选/取消全选,更新所有节点勾选状态
2. 勾选父/子节点,子/父节点状态和全选框状态更新

效果图

全选

在这里插入图片描述

取消全选

在这里插入图片描述

取消父节点

在这里插入图片描述

取消某个子节点

在这里插入图片描述

关键代码

这里是vue2写法,不管什么写法逻辑是一样滴!

<template><el-tableref="multipleTable"v-loading="loading"row-key="id":data="tableList":tree-props="{ children: 'children' }"@select-all="selectAll"@select="handleSelect"><el-table-column type="selection" width="55"> </el-table-column></el-table>
</template>
<script>
export default {methods: {// 递归设置子节点的勾选状态setChildrenSelection(children, selected) {if (!children || children.length === 0) return;children.forEach((child) => {this.$refs.multipleTable.toggleRowSelection(child, selected);this.setChildrenSelection(child.children, selected);});},// 更新父节点的勾选状态updateParentSelection(node) {if (!node || !node.pid) return; // 如果没有父节点,递归终止const parent = this.findNodeById(node.pid);if (!parent) return; // 如果父节点不存在,退出// 检查父节点的所有子节点是否都被勾选const allChildrenSelected = parent.children.every((child) =>this.$refs.multipleTable.selection.some((item) => item.id === child.id));// 根据子节点的勾选状态更新父节点的勾选状态this.$refs.multipleTable.toggleRowSelection(parent, allChildrenSelected);// 递归更新父节点的父节点this.updateParentSelection(parent);},// 根据 ID 查找节点findNodeById(id) {const stack = [...this.tableList];while (stack.length) {const node = stack.pop();if (node.id === id) return node;if (node.children && node.children.length) {stack.push(...node.children);}}return null;},// 勾选事件处理handleSelect(selection, row) {if (row.children && row.children.length) {// 如果当前节点有子节点,递归设置子节点的勾选状态const isCurrentSelected = selection.some((item) => item.id === row.id);this.setChildrenSelection(row.children, isCurrentSelected);}// 更新父节点的勾选状态this.updateParentSelection(row);},// 全选事件处理selectAll(selection) {this.tableList.forEach((row) => {const isRowSelected = selection.some((item) => item.id === row.id);this.$refs.multipleTable.toggleRowSelection(row, isRowSelected);// 递归设置子节点的勾选状态this.setChildrenSelection(row.children, isRowSelected);});},},
};
</script>
// 若想要获取表格选中的数据
const selectedRows = this.$refs.multipleTable.selection;
http://www.dtcms.com/wzjs/512110.html

相关文章:

  • 拖拽式wordpress建站网页搜索快捷键是什么
  • 做淘宝客网站需要多大空间潜江seo
  • dede模板蓝色大气简洁企业网站模板下载中国企业100强
  • 做视频网站采集需要多大的空间推广搜索引擎
  • 备案时网站关闭小红书推广引流软件
  • 成都怎样制作公司网站竞价推广营销
  • 专门 做鞋子团购的网站有哪些武汉seo建站
  • 自已做个网站怎么做百度怎么做推广和宣传
  • 百度推广建设网站是不是合发今日热点头条
  • 微信人生里面微网站怎么做山东东营网络seo
  • 买的服务器怎么做网站免费的建站平台
  • 网站建设方案打包在线外链发布工具
  • 濮阳做网站亚马逊关键词
  • 专业网页制作流程优化大师卸载不了
  • 免费的设计网站有哪些赣州seo推广
  • 设计素材网站收益互联网网络推广公司
  • 免费新闻网站建设企业管理培训课程视频
  • 房产网站怎么做seo就业
  • asp.net 网站写好后如何运行核心关键词和长尾关键词
  • 在谷歌上做国际网站建立网站一般要多少钱
  • 做网站靠广告一年赚多少钱seo内部优化方案
  • 个人网站设计电商平台网站
  • 网站滚屏是用什么做的百度帐号登录入口
  • wordpress引导页seo还有哪些方面的优化
  • 建网站中企动力深圳市seo上词多少钱
  • 城市旅游网站开发如何提升网站搜索排名
  • 微网站如何做推广口碑营销的例子
  • 精准营销平台上海seo公司
  • 建立网站服务的公司网站企业培训考试
  • 美食网站黑米如何做网络推广常见的方法