Add events
parent
f645b96ee8
commit
c954f5dbe2
|
@ -83,7 +83,7 @@ export default {
|
||||||
switch (event.which) {
|
switch (event.which) {
|
||||||
//down arrow
|
//down arrow
|
||||||
case 40:
|
case 40:
|
||||||
const listElement = nodeElement.children[1];
|
var listElement = nodeElement.children[1];
|
||||||
if (listElement) {
|
if (listElement) {
|
||||||
this.focusNode(listElement.children[0]);
|
this.focusNode(listElement.children[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<h3>Single Selection</h3>
|
<h3>Single Selection</h3>
|
||||||
<Tree :value="nodes" selectionMode="single" :selectionKeys.sync="selectedKey"></Tree>
|
<Tree :value="nodes" selectionMode="single" :selectionKeys.sync="selectedKey1"></Tree>
|
||||||
|
|
||||||
<h3>Multiple Selection with MetaKey</h3>
|
<h3>Multiple Selection with MetaKey</h3>
|
||||||
<Tree :value="nodes" selectionMode="multiple" :selectionKeys.sync="selectedKeys1"></Tree>
|
<Tree :value="nodes" selectionMode="multiple" :selectionKeys.sync="selectedKeys1"></Tree>
|
||||||
|
@ -21,6 +21,10 @@
|
||||||
|
|
||||||
<h3>Checkbox Selection</h3>
|
<h3>Checkbox Selection</h3>
|
||||||
<Tree :value="nodes" selectionMode="checkbox" :selectionKeys.sync="selectedKeys3"></Tree>
|
<Tree :value="nodes" selectionMode="checkbox" :selectionKeys.sync="selectedKeys3"></Tree>
|
||||||
|
|
||||||
|
<h3>Events</h3>
|
||||||
|
<Tree :value="nodes" selectionMode="single" :selectionKeys.sync="selectedKey2" :metaKeySelection="false"
|
||||||
|
@node-select="onNodeSelect" @node-unselect="onNodeUnselect"></Tree>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TreeDoc />
|
<TreeDoc />
|
||||||
|
@ -34,7 +38,8 @@ import TreeSubMenu from './TreeSubMenu';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedKey: null,
|
selectedKey1: null,
|
||||||
|
selectedKey2: null,
|
||||||
selectedKeys1: null,
|
selectedKeys1: null,
|
||||||
selectedKeys2: null,
|
selectedKeys2: null,
|
||||||
selectedKeys3: null,
|
selectedKeys3: null,
|
||||||
|
@ -48,6 +53,14 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.nodeService.getTreeNodes().then(data => this.nodes = data);
|
this.nodeService.getTreeNodes().then(data => this.nodes = data);
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
onNodeSelect(node) {
|
||||||
|
this.$toast.add({severity:'success', summary: 'Node Selected', detail: node.label, life: 3000});
|
||||||
|
},
|
||||||
|
onNodeUnselect(node) {
|
||||||
|
this.$toast.add({severity:'success', summary: 'Node Unselected', detail: node.label, life: 3000});
|
||||||
|
}
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
'TreeDoc': TreeDoc,
|
'TreeDoc': TreeDoc,
|
||||||
'TreeSubMenu': TreeSubMenu
|
'TreeSubMenu': TreeSubMenu
|
||||||
|
|
Loading…
Reference in New Issue