0

我正在尝试覆盖 shift+click 以选择树中的多个节点。我按照教程中的方法进行操作

import { ITreeOptions, TreeNode,TREE_ACTIONS,KEYS,IActionMapping} from 'angular-tree-component';
actionMapping: IActionMapping = {
    mouse: {
      click: (tree, node, $event) => {
        $event.shiftKey
          ? TREE_ACTIONS.TOGGLE_SELECTED_MULTI(tree, node, $event)
          : TREE_ACTIONS.TOGGLE_SELECTED(tree, node, $event)
      }
    }
  };
@ViewChild('tree') tree: any;
 treeOptions: ITreeOptions = {
    actionMapping:this.actionMapping,
    getChildren: this.getChildren.bind(this),
    useVirtualScroll: true,
    nodeHeight: 22
 };
<tree-root #tree [nodes]="nodes" [focused]="true" [options]="treeOptions" (updateData)="treeUpdate()" (moveNode)="onMoveNode($event)">
...
</tree-root>

但它不起作用,TREE_ACTIONS 上不存在属性“TOGGLE_SELECTED_MULTI”。

4

1 回答 1

0
const actionMapping:IActionMapping = {
  mouse: {
    click: TREE_ACTIONS.TOGGLE_ACTIVE_MULTI
  }
};

public options = { 
    actionMapping
  };

和 HTML 一样

<tree-root [nodes]="nodes" [options]="options"></tree-root>
于 2021-04-30T13:46:29.590 回答