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

@weilan/el-tree-table

v0.1.7

Published

a tree table based on vue and element-ui,一个基于vue和element-ui的树形表格

Downloads

17

Readme

el-tree-table

简介

el-tree-table组件基于vue和element-ui,在 vue-element-admin 的实现基础上增加一些新特性。 并在此声明treetable的业务实现再来上述开源项目,如有冒犯,请及时联系。 共同依据element-ui的el-table写成。

扩展主要包括:显示边框、固定高度、显示复选框、复选框选中是否遵循父子关联、复选框禁用条件。

在线访问 - GitHub

这里有一个兄弟组件-树形穿梭框:在线访问 - GitHub

快速上手

npm i @weilan/el-tree-table --save

npm i @weilan/el-tree-table -S

import TreeTable from '@weilan/el-tree-table'

Vue.use(TreeTable)

示例 <treeTable :data="tree_table" :columns="columns" checkBox expandAll parentChild border :options="{key:'id', children:'Children'}" @treeTableSelect="getTreeTableSelect" />

<script>

export default {
  name: 'app',
  data(){
    return {
      columns: [
        {
          value: "id",
          text: "值",
        },
        {
          value: "name",
          text: "名字"
        }
      ],
      tree_table:[
        {
          id: "1",
          name: "第1级",
          Children: [
           {
             id: "1-1",
             name: "第1-1级",
             Children: [
               /* {
                  id: "1-1-1",
                  name: "第1-1-1级",
                }, */
                {
                  id: "1-1-2",
                  name: "第1-1-2级",
                  Children: [
                    {
                  id: "1-1-2-1",
                  name: "第1-1-2-1级",
                },
                {
                  id: "1-1-2-2",
                  name: "第1-2-2-2级",
                },
                  ]
                },
             ]
           },
           {
             id: "1-2",
             name: "第1-2级",
             Children: [
                {
                  id: "1-2-1",
                  name: "第1-2-1级",
                },
                {
                  id: "1-2-2",
                  name: "第1-2-2级",
                },
             ]
           },
          ]
        }
      ]
    }
  },
  methods: {
    getTreeTableSelect(val){
      console.log(val);
    }
  },
}
</script>

文档

  1. 参数:data 说明:树形数据 类型:Array, Object 必填:true 补充:对象或数组

  2. 参数:columns 说明: 列属性 类型:Array 必填:false 补充:text: 显示在表头的文字,value: 对应data的key。treeTable将显示相应的value, width: 每列的宽度,为一个数字(可选),如果你想要每个字段都有自定义的样式或者嵌套其他组件,columns可不提供,直接像在el-table一样写即可,如果没有自定义内容,提供columns将更加的便捷方便

  3. 参数:expandAll 说明:是否展开全部 类型:Boolean 必填:false

  4. 参数:evalFunc 说明:解析函数 类型:Function

  5. 参数:evalArgs 说明:解析函数参数 类型:Array

以上说明详见(https://github.com/PanJiaChen/vue-element-admin/tree/master/src/components/TreeTable)。

  1. 参数:options 说明:nodekey字段及children字段 类型:Boolean 必填:false 补充:重要!根据id和children盒子字段来父子关联处理数据,默认{key: "id", children: "children"},如需自定义,请一块修改

  2. 参数:checkBox 说明:是否显示复选框 类型:Boolean 必填:false

  3. 参数:height 说明:用于固定表头 类型:Number 必填:false

  4. 参数:border 说明:显示边框 类型:Boolean 必填:false 补充:默认为true显示边框

  5. 参数:disabled 说明:当checkBox为true显示复选框时可用,判断是否禁用字段 类型:String 补充:此参数传入内容为:data中表示复选框是否禁用的数据字段 例{isDisabled: true, id: 1, children:[]},则disabled: 'isDisabled'

  6. 参数:parentChild 说明:当checkBox为true显示复选框时可用,表示是否遵循父子关联 类型:Boolean 补充:默认false

  7. 事件:openChildren 说明:点击图标展开子元素事件 回调:function(row, status), 返回点击行Object, 展开状态Boolean

  8. 事件:treeTableClick 说明:点击列表行事件 回调:function(row), 返回点击行,注意:重复点击则取消选中并返回{}

  9. 事件:treeTableSelect 说明:复选框选中事件 回调:function(val), 返回选中数据

  10. slot:这是一个自定义列的插槽 slotcolumns属性可同时存在,columns里面的数据列会在slot自定义列的左边展示