@kevin5979/util-fn
v1.0.0
Published
一些封装方法
Downloads
2
Readme
一些封装方法
handleAllChecked
- 解决el-tree全选后, 新增的节点默认有选中效果的bug
let dataSource = [
{
name: "test1",
id: "test1",
codes: "test1",
children: [
{
name: "test2",
id: "test2",
codes: "test2"
},
{
name: "test3",
id: "test3",
codes: "test3"
},
{
name: "test4",
id: "test4",
codes: "test4"
}
]
}
];
/**
* 解决el-tree全选后, 新增的节点默认有选中效果的bug
* @param dataSource 数据源
* @param selected 已经选中
* @param children 数据children字段
* @param field 选中数据字段
* @returns {*}
*/
let res = handleAllChecked(dataSource, ["test1", "test2", "test3"], "children", "id");
console.log(res); // [ 'test2', 'test3' ]