
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
tree-nodes-dl
Advanced tools
code Pen
https://codepen.io/JOSEJUAN/pen/jOWBreV?editors=1101
npm install tree-nodes-dl
global use
import Vue from 'vue';
import treeNodesDl from 'tree-nodes-dl';
Vue.use(treeNodesDl);
local use
import treeNodes from 'tree-nodes-dl';
...
export default {
components: {
treeNodes,
}
}
<template>
<tree-nodes-dl
class="tree-container"
children=inner
text=title
:indent="15"
:nodes="treeData"
v-slot="{ node, isOpen }"
>
<div class="slot-node">
<span v-if="!isOpen && node.inner">+</span>
<span v-if="isOpen && node.inner">-</span>
<h2
:class="{'lm': !node.inner }"
>Desde slot: {{node.title}}</h2>
<button
type="button"
@click.stop
>click me!</button>
</div>
</tree-nodes-dl>
</template>
<script>
import treeNodes from 'tree-nodes-dl';
function data() {
return {
treeData: [
{
title: "A",
otherProp: false,
inner: [
{
title: "A.1",
inner: [
{
title: "A.1.1"
}
]
},
{
title: "A.2",
inner: [
{
title: "A.2.1"
},
{
title: "A.2.2"
}
]
},
{
title: "A.3",
inner: [
{
title: "A.3.1"
}
]
},
{
title: "A.4",
inner: [
{
title: "A.4.1"
}
]
}
]
},
{
title: "B",
inner: [
{
title: "B.1",
inner: [
{
title: "B.1.1"
},
{
title: "B.1.2"
}
]
},
{
title: "B.2",
inner: [
{
title: "B.2.1"
}
]
},
{
title: "B.3",
inner: [
{
title: "B.3.1"
}
]
},
{
title: "B.4",
inner: [
{
title: "B.4.1"
}
]
}
]
},
{
title: "C"
},
{
title: "D"
}
],
}
}
export default {
components: {
treeNodes,
},
data,
}
</script>
.slot-node {
align-items: center;
cursor: default;
display: flex;
span {
font-weight: bold;
font-size: 20px;
height: 20px;
margin-right: 10px;
width: 20px;
}
h2 {
width: 100%;
&.lm {
margin-left: 30px;
}
}
button {
cursor:pointer;
width: 10%;
}
}
name | type | observation |
---|---|---|
node | Object | Element of the array |
isOpen | Boolean | true : node open. false node collapsed |
Note: you can use event handlers like
click
in de slot but this will change the node state (collapsed or opened). If you don't want this behavior just addstop
as modifier in theevent
(@click.stop="clickHandler") orstopPropagation()
(function clickHandler(e, node, isOpen) { e.stopPropagation()...})
name | Observation |
---|---|
.node-container-wrapper | This is the main class and it's wrapping the node . You can access the node through this class. |
collapsing | This is de vue transition name. You can use it to apply custom transitions for collaping the node |
.node | This is the node class. |
Note: If you want more details please check here.
FAQs
Unknown package
The npm package tree-nodes-dl receives a total of 9 weekly downloads. As such, tree-nodes-dl popularity was classified as not popular.
We found that tree-nodes-dl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.