Comments (4)
check-strictly 为 false 的时候,只有子节点(叶子结点)能被选中,是有什么问题吗?
在我的场景里 ,这个11 其实是个分组(组是仓库组的概念) ,只是这个组下没有了children。 children是仓库的概念 我是选择框是为了收集仓库的id发送给服务端
我设想的check-strictly 只能选择仓库
我理解最终为什么能选择11,因为 11 这个分组已经没有children了 他被认为了是一个children
提这个issue是在想,能否提供其他的参数 让check-strictly分清层级 至少目前来看 我觉得check-strictly是不合理的
我最终的解决方案是 删除所有空的children&&type是group 的节点,得到一个处理好的数据
/** * 处理树形数据,删除children为null的节点 * @param tree */ function removeEmptyGroupNodes(tree: IWarehouseGroupListParamVO[]): IWarehouseGroupListParamVO[] { return tree.reduce((acc: IWarehouseGroupListParamVO[], item: IWarehouseGroupListParamVO) => { // 如果当前节点有子节点,对子节点进行递归处理 if (item.children && item.children.length > 0) { item.children = removeEmptyGroupNodes(item.children); } // 如果当前节点的children为null且type为'group',则删除该节点 if (item.children === null && item.type === 'group') { console.log('删除的节点', item); return acc; // 不将当前节点添加到累加器中 } // 如果子节点数组被清空,且当前节点type为'group',则不添加当前节点到累加器 if (item.children && item.children.length === 0 && item.type === 'group') { console.log('删除的父节点', item); return acc; } // 否则,将当前节点添加到累加器中 acc.push(item); return acc; }, []); }
是不是可以像这个 demo 一样,把所有选择框显示出来,然后通过禁用的方式,来禁止选择
from element-plus.
check-strictly 为 false 的时候,只有子节点(叶子结点)能被选中,是有什么问题吗?
from element-plus.
check-strictly 为 false 的时候,只有子节点(叶子结点)能被选中,是有什么问题吗?
在我的场景里 ,这个11 其实是个分组(组是仓库组的概念) ,只是这个组下没有了children。 children是仓库的概念
我是选择框是为了收集仓库的id发送给服务端
我设想的check-strictly 只能选择仓库
我理解最终为什么能选择11,因为 11 这个分组已经没有children了 他被认为了是一个children
提这个issue是在想,能否提供其他的参数 让check-strictly分清层级 至少目前来看 我觉得check-strictly是不合理的
我最终的解决方案是 删除所有空的children&&type是group 的节点,得到一个处理好的数据
/**
* 处理树形数据,删除children为null的节点
* @param tree
*/
function removeEmptyGroupNodes(tree: IWarehouseGroupListParamVO[]): IWarehouseGroupListParamVO[] {
return tree.reduce((acc: IWarehouseGroupListParamVO[], item: IWarehouseGroupListParamVO) => {
// 如果当前节点有子节点,对子节点进行递归处理
if (item.children && item.children.length > 0) {
item.children = removeEmptyGroupNodes(item.children);
}
// 如果当前节点的children为null且type为'group',则删除该节点
if (item.children === null && item.type === 'group') {
console.log('删除的节点', item);
return acc; // 不将当前节点添加到累加器中
}
// 如果子节点数组被清空,且当前节点type为'group',则不添加当前节点到累加器
if (item.children && item.children.length === 0 && item.type === 'group') {
console.log('删除的父节点', item);
return acc;
}
// 否则,将当前节点添加到累加器中
acc.push(item);
return acc;
}, []);
}
from element-plus.
是不是可以像这个 demo 一样,把所有选择框显示出来,然后通过禁用的方式,来禁止选择
是的,通过某个prop控制选择
from element-plus.
Related Issues (20)
- [Component] [tree] 使用tree 拖动元素时候,如果超出了tree的可操作区域就不应该拖动成功,现在可以拖动成功
- [Component] [All] 在谷歌21版本的浏览器中,el-input输入中文自动带入拼音 HOT 3
- [Component] [table-v2] Component] [table-v2] el-table-v2 设置columns的fixed属性后,如果row-key使用数字或者数字开头的字符串,onRowHovered 事件报错
- [Component] [tree-select] TreeSelect 在文档中的分类应当为 Form 表单组件
- [Component] [table, table-column] 当表格中所有列都是fixed时,虽然内容未超出,但表格仍然会有横向滚动
- [Style] [tabs, tab-pane] 给el-tabs__item的style添加 padding-lert right !important 导致只有一个ElTabPane的时候下划线长度计算错误 HOT 1
- [Component] [date-picker] el-date-picker的type为datetimerange时,选择同一天,下拉面板左右两边显示两个相同的月份
- [Component] [input] 设置validate-event为true后,输入内容不触发表单校验,但是change后也不触发校验 HOT 2
- [Component] [color-picker] color-picker在使用“预定义颜色”功能时,设置show-alpha=false,会使预定义颜色框没有“被选中状态”
- [TypeScript] [All] 组件类型报错,提示缺少属性 HOT 3
- [Component] [notification] Notification 通知组件的title与message会出现不换行然后超出当前范围的情况 HOT 1
- [Component] [select] Select组件v-model绑定对象时异常 HOT 3
- [Component] [scrollbar] 滚动条处理异常问题 HOT 3
- [TypeScript] [date-picker] el-date-picker type类型是type="years"时 v-model:model-value的ts类型不支持string[] HOT 2
- [TypeScript] [popover] Popover 气泡卡片 effect Type bug HOT 1
- [i18n] [table-v2] headers freezed while scrolling in rtl mode and has icorrect order
- [Component] [watermark] watermark组件 windows系统下水印文字显示不全 HOT 1
- [Component] [input-number] input '+‘ or 'e',value is null HOT 3
- [Component] [select] el-select 当 multiple 为 false 时,不支持"自定义标签"功能 HOT 3
- [Component] [input] textarea组件在focus时,没有增加is-focus的className
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from element-plus.