style: format code

pull/2900/head
tanjinzhou 2020-09-24 13:29:24 +08:00
parent d3d787e2b0
commit b154eeed28
2 changed files with 4 additions and 6 deletions

View File

@ -66,7 +66,7 @@ export default {
// Expanded keys // Expanded keys
if (defaultExpandAll) { if (defaultExpandAll) {
if (props.treeData) { if (props.treeData) {
state._expandedKeys = getFullKeyListByTreeData(props.treeData,props.replaceFields); state._expandedKeys = getFullKeyListByTreeData(props.treeData, props.replaceFields);
} else { } else {
state._expandedKeys = getFullKeyList(children); state._expandedKeys = getFullKeyList(children);
} }

View File

@ -88,14 +88,12 @@ export function convertDirectoryKeysToNodes(rootChildren, keys) {
return nodes; return nodes;
} }
export function getFullKeyListByTreeData(treeData,replaceFields) { export function getFullKeyListByTreeData(treeData, replaceFields = {}) {
let keys = []; let keys = [];
const {key='key',children='children'} = replaceFields const { key = 'key', children = 'children' } = replaceFields(treeData || []).forEach(item => {
(treeData || []).forEach(item => {
keys.push(item[key]); keys.push(item[key]);
if (item[children]) { if (item[children]) {
keys = [...keys, ...getFullKeyListByTreeData(item[children],replaceFields)]; keys = [...keys, ...getFullKeyListByTreeData(item[children], replaceFields)];
} }
}); });
return keys; return keys;