Comments (1)
You can add a node under a node by mutating the ref
value you binded.
An example that we use in Wope:
import { getNodeById } from 'vue3-tree';
export function addTagToTree({ name, parentId, tree }) {
const node = {
id: nanoid(),
label: name,
checked: true,
};
if (parentId) {
const parentNode = getNodeById(tree, parentId);
parentNode.expanded = true;
if (parentNode.nodes) parentNode.nodes.push(node);
else parentNode.nodes = [node];
return;
}
tree.push(node);
}
from vue3-tree.
Related Issues (20)
- Edit wrong data thrown with onDataUpdated
- When updating updateNode it should be updated according to the value of useCheckbox
- Change onUpdate emit name
- Misleading naming on TreeRow
- Support for drag & drop (reordering nodes) ? HOT 3
- Support empty nodes array HOT 2
- How do I handle initial checked nodes ? HOT 3
- Support for onClickNode? HOT 3
- Using via cdn HOT 1
- Nodes should be renamed to "children"
- Prop names starting with "use-*" should be changed to "show-*".
- Inline style related props should be removed.
- `id` should not be required.
- tree-row clickability HOT 1
- Styling with Tailwind HOT 1
- Demo HOT 3
- Toggling checkbox of parent does not toggle checkbox of all children
- Scope on node label
- Documentation link error 404 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue3-tree.