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] [menu] el-menu 组件产生谷歌浏览器控制台警告:Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. HOT 1
- [Style] [table-column, table] 嵌套Table fixed column显示问题
- [Component] [table-column] 浏览器缩放110%,table文字长度不到列宽一半,鼠标悬浮却显示了tooltip HOT 4
- [Component] [select] el-select中, 无法回显value为空的option的label HOT 1
- [Component] [tour] CDN 下使用el-tour 会报错aria.ts:22 Uncaught (in promise) ReferenceError: process is not defined HOT 11
- [Style] [table] 表格内容溢出时,鼠标移入显示的tooltip背景色显示无效 HOT 2
- [Component] [input] input component: The clearable attribute is invalid HOT 1
- [Component] [date-picker, time-picker] DatePicker 选中值并隐藏下拉选项后,在先聚焦外部的情况下,再次点击页面其它地方会再次出现消失动画 HOT 2
- [Component] [table, table-column] table 多列合并后渲染了多余的数据 HOT 3
- [Component] [table, table-column] el-table内的show-overflow-tooltip属性,在windows的chrome浏览器内,会在文字没有溢出时,也会出现Tooltip 文字提示 HOT 2
- [Component] [input-number] <el-input-number> 可以输入e 其他都输不了 HOT 1
- [Component] [color-picker] Cannot set class name of el-color-picker’s trigger
- [Component] [radio] radio无法被选中 HOT 4
- [Style] [dropdown] Dropdown 下拉菜单 HOT 6
- [slider] slider 组件会响应home和end的快捷键,我不想让他响应,我应该怎么做? HOT 11
- [Component] [tree-select] 开启 `allow-create` 时样式错乱
- [Component] [All] Failed to resolve component: el-button If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. HOT 1
- [Component] [select]: select 配置可清空功能,清空后值变成undefined,类型发生变化 HOT 7
- [Component] [row, col] 当横向渲染分辨率设置为767px时el-col组件布局失去响应式。
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.