# vue3-blocks-tree **Repository Path**: Sxen77/vue3-blocks-tree ## Basic Information - **Project Name**: vue3-blocks-tree - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-01 - **Last Updated**: 2024-04-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue3-blocks-tree > A simple organization structure tree view based on Vue3.x. It supports events, slots, horizontal vision and nodes manipulation Thanks to [hukaibaihu](https://github.com/hukaibaihu/vue-org-tree) and his sources for vue 2 taken as basis. ## Usage ```vue ``` ### Demo [https://megafetis.github.io/vue3-blocks-tree-demo] ### NPM ``` # use npm npm i vue3-blocks-tree # use yarn yarn add vue3-blocks-tree ``` ### Import Plugins ``` js import {createApp} from 'vue'; import VueBlocksTree from 'vue3-blocks-tree'; import 'vue3-blocks-tree/dist/vue3-blocks-tree.css'; // or import 'vue3-blocks-tree/src/styles/blocks-tree.less'; let defaultoptions = {treeName:'blocks-tree'} createApp(App) .use(VueBlocksTree,defaultoptions) // or .component('blocks-tree',VueBlocksTree) // ... ``` ## API api | descripton | type ------------------|-------------------------------------------------------------|:--------------------------------------------------------------------- node context | Context to node manipulation in slot or in event callback | interface NodeContext { isExpanded():boolean; toggleExpand():void; } #### props prop | descripton | type | default ------------------|-----------------------------------------|:----------------------:|:---------------------------------------------------------: data | | `Object` | props | configure props | `Object` | `{label: 'label', children: 'children', expand: 'expand',key: 'id'}` labelWidth | node label width | `String` \| `Number` | `auto` collapsable | children node is collapsable | `Boolean` | `true` renderContent | how to render node label | `Function` | - labelClassName | node label class | `Function` \| `String` | - ### events event name | descripton | type ------------------|-----------------------------------------|:---------------------- node-click | Click event | `Function` node-mouseover | onMouseOver event | `Function` node-mouseout | onMouseOut event | `Function` node-expand | click expand button event | `Function` ### Slots slot name | descripton | params ------------------|-----------------------------------------|:---------------------- node | current node scoped slot | data - node data, context - node context #### node-expand well be called when the collapse-btn clicked - params `e` `Event` - params `data` `Current node data` - params `context` `Node context` #### node-click well be called when the node-label clicked - params `e` `Event` - params `data` `Current node data` - params `context` `Node context` #### node-mouseover It is called when the mouse hovers over the label. - params `e` `Event` - params `data` `Current node data` - params `context` `Node context` #### node-mouseout It is called when the mouse leaves the label. - params `e` `Event` - params `data` `Current node data` - params `context` `Node context` ## Example - default ![default](./images/default.png) - horizontal ![horizontal](./images/horizontal.png) - use node slot ![horizontal](./images/slots.png) ## License [MIT](http://opensource.org/licenses/MIT) Buy Me A Coffee