问题:
如果子节点也全部算上的话请求参数过长
当子节点全选时只传父节点
// 获取父节点的方法
getSimpleCheckedNodes(store) {
const checkedNodes = [];
const traverse = function(node) {
const childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach(child => {
if (child.checked) {
checkedNodes.push(child.data);
}
if (child.indeterminate) {
traverse(child);
}
});
};
traverse(store)
return checkedNodes;
},
//调用获取节点
let res = this.getSimpleCheckedNodes(this.$refs.tree.store)