双击角树组件不起作用,这是我尝试使用的代码示例。我是否需要在代码中编写其他内容,以便它可以工作?请帮我解决这个问题。谢谢。
import { Component, Input } from '@angular/core';
import { TreeNode, TreeModel, TREE_ACTIONS, KEYS, IActionMapping, ITreeOptions } from 'angular-tree-component';
const actionMapping:IActionMapping = {
mouse: {
contextMenu: (tree, node, $event) => {
$event.preventDefault();
alert(`context menu for ${node.data.name}`);
},
dblClick: (tree, node, $event) => {
if (node.hasChildren) {
TREE_ACTIONS.TOGGLE_EXPANDED(tree, node, $event);
}
},
click: (tree, node, $event) => {
$event.shiftKey
? TREE_ACTIONS.TOGGLE_ACTIVE_MULTI(tree, node, $event)
: TREE_ACTIONS.TOGGLE_ACTIVE(tree, node, $event);
}
},
keys: {
[KEYS.ENTER]: (tree, node, $event) => alert(`This is ${node.data.name}`)
}
};