npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@devsun/vue3-simple-tree

v0.0.1

Published

vue3-simple-tree is very simple tree library.

Downloads

2

Readme

Vue3 Simple Tree

vue3-simple-tree is very simple tree library.

It was based on Vue3, typescript.

Setup

npm i @devsun/vue3-simple-tree

Usage

Component

You can use <simple-tree />:

<simple-tree
        ref="simpleTreeRef"
        :data="data"
        id-key="menuId"
        name-key="menuNm"
        parent-id-key="parentMenuId"
        root-id=""
        :checkable="checkable"
        :selectable="selectable"
        :draggable="draggable"
        :include-indeterminate="includeIndeterminate"
        :expand-all="expandAll"
        :expand-options="expandOptions"
        @check="handleCheckTree"
        @select="handleSelectTree"
></simple-tree>

Attributes

| Name | Type | Default | Description | | --------------------- | ------------------------------- | --------- | ------------------------------------------------------ | | ref | String | | used for tree API call | | data | Object[] | [] | Required | | idKey | String | | RequiredUsing by id from data | | nameKey | String | | RequiredUsing by name from data | | parentIdKey | String | | RequiredUsing by parent id from data | | rootId | String | undefined | parentId of root node from data | | checkable | Boolean | false | Whether to show a checkbox | | includeIndetereminate | Boolean | false | Whether to include indeterminated node in checked data | | selectable | Boolean | false | Whether to use the selection | | draggable | Boolean | false | Whether to change the tree by drag and drop | | expandAll | Boolean | true | Whether to expand all nodes | | expandOptions | { ids: string[], level: number} | | Expand specific nodes |

Event

check

() => Object[]

<simple-tree
        @check="handleCheckTree"
></simple-tree>

select

() => Object

<simple-tree
        @select="handleSelectTree"
></simple-tree>

API

getCheckedData

() => Object[]

return checked data

<script lang="ts" setup>
	const simpleTreeRef = ref(null);
    function getCheckedData() {
       const checkedData =  simpleTreeRef.value.getCheckedData();
    }
</script>

<template>
	<simple-tree
        ref="simpleTreeRef"
        ...
	></simple-tree>
</template>

getChangedData

() => Object[]

return chagned data by drag and drop

<script lang="ts" setup>
	const simpleTreeRef = ref(null);
    function getChangedData() {
       const changedData =  simpleTreeRef.value.getChangedData();
    }
</script>

<template>
	<simple-tree
        ref="simpleTreeRef"
        ...
	></simple-tree>
</template>

getSelectedData

() => Object[]

return selected data

<script lang="ts" setup>
	const simpleTreeRef = ref(null);
    function getSelectedData() {
       const selectedData =  simpleTreeRef.value.getSelectedData();
    }
</script>

<template>
	<simple-tree
        ref="simpleTreeRef"
        ...
	></simple-tree>
</template>

getData

() => Object[]

return latest data

<script lang="ts" setup>
	const simpleTreeRef = ref(null);
    function getData() {
       const latestData =  simpleTreeRef.value.getData();
    }
</script>

<template>
	<simple-tree
        ref="simpleTreeRef"
        ...
	></simple-tree>
</template>

Global Component

use gloabl component:

// main.ts
import { plugin as SimpleTreePlugin } from '@devsunp/vue3-simple-tree';

const app = createApp(App);

// use plugin
app.use(SimpleTreePlugin);

app.mount('#app');