我正在尝试将树从一个div拖放到另一个div。一切工作正常,但只有被拖拽的树的节点扩展根本不起作用。另一方面,原始树节点扩展运行良好。
app.component.html
<div class="wrapper">
<div class="container" [dragula]='"bag-task1"'id='left'>
<div> <tree [tree]="tree" (nodeExpanded)="handleExpanded($event)"></tree></div>
</div>
<div class="container" [dragula]='"bag-task1"'id='right'>
<div></div>>
</div>
</div>`
我也尝试了allowDrag:true
和allowDrop:true
。但这是行不通的。是否有任何ID问题或克隆或其他内容。
app.component.ts
import { Component } from '@angular/core';
import { DragulaService} from 'ng2-dragula/ng2-dragula'
import { TreeModel,NodeEvent } from 'ng2-tree';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers:[DragulaService]
})
export class AppComponent {
title = 'app';
constructor(private dragula:DragulaService){
dragula.setOptions('bag-task1',{
copy:true
});
}
public tree: TreeModel = {
isExpanded: true,
value: 'Programming languages by programming paradigm',
children: [
{
isExpanded: true,
value: 'Object-oriented programming',
children: [{ value: 'Java' }, { value: 'C++' }, { value: 'C#' }]
},
{
value: 'Prototype-based programming',
children: [{ value: 'JavaScript' }, { value: 'CoffeeScript' }, {
value: 'Lua' }]
}
]
};
}