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

@luxiaodan/el-selection-tree-table

v1.0.3

Published

基于element-ui table组件二次封装的树表格组件,主要解决element-ui中数表格中checkbox无法进行父子组件联动的问题,其中还包含了element-ui中的分页组件,needReverse参数用于配置是否需要在分页过程中保持每一页的选中状态和expand状态

Downloads

2

Readme

el-selection-tree-table

基于element-ui table组件二次封装的树表格组件,主要解决element-ui中数表格中checkbox无法进行父子组件联动的问题,其中还包含了element-ui中的分页组件,needReverse参数用于配置是否需要在分页过程中保持每一页的选中状态和expand状态

安装

npm install @luxiaodan/el-selection-tree-table

使用


<template>
  <div>
    <selection-tree-table 
      :table-data="tableData" 
      :columns="columns"
      row-key="rowKey" 
      style="width: 100%"
      border
      :current-page="pageNo"
      ::page-size="pageSize"
      :total="2"
      :has-pagination="false"
      :pagination-props="{
        layout: 'prev, pager, next, sizes',
        pageSizes: [1,2]
      }"
      :need-reverse="true"
      @select-change="selectChangeHandler"
      @current-change="pageChange"
      @size-change="sizeChangeHandler"
    >
    <template slot="expr" slot-scope="scope">
      <span v-if="scope.row.expr">{{ scope.row.expr }}</span>
      <span v-else>————</span>
    </template>
    </selection-tree-table>
  </div>

</template>

<script>
import data from './data'
import SelectionTreeTable from '@luxiaodan/el-selection-tree-table'

export default {
  name: 'Example',
  components: {
    SelectionTreeTable
  },
  data() {
    return {
      tableData: [data[0]],
      columns: [
        {
          label: '岗位',
          prop: 'name'
        },
        {
          label: '编码',
          prop: 'rowKey'
        },
        {
          label: '负责人',
          prop: 'leader'
        },
        {
          label: '创建时间',
          prop: 'createTime'
        },
        {
          label: '经验要求',
          prop: 'expr'
        },
        {
          label: '发布天数',
          prop: 'date'
        }
      ],
      rowKey: 'rowKey',
      pageSize: 1,
      pageNo: 1
    }
  },
  methods: {
    pageChange(curPage) {
      this.pageNo = curPage
      const start = (curPage - 1) * this.pageSize
      const end = start + this.pageSize
      this.tableData = data.slice(start, end)
    },
    sizeChangeHandler(size) {
      this.pageNo = 1
      this.pageSize = size
      this.pageChange(this.pageNo)
    },
    clear() {
      this.$refs.table.clearSelection()
      this.selections = []
    },
    selectChangeHandler(selection, selectionIds) {
      console.log(selectionIds)
    }
  }
}
</script>
const data = [
  {
    rowKey: 2,
    name: '设计岗',
    leader: '吴九',
    createTime: '2018-07-24',
    expr: '',
    date: '26天',
    children: [
      {
        rowKey: 21,
        name: '视觉设计',
        leader: '吴九',
        createTime: '2018-07-24',
        expr: '',
        date: '26天',
        children: [
          {
            rowKey: 211,
            name: '视觉设计师',
            leader: '吴小九',
            createTime: '2018-07-24',
            expr: '1-3年',
            date: '26天'
          },
          {
            rowKey: 212,
            name: '网页设计师',
            leader: '吴小十',
            createTime: '2018-07-24',
            expr: '3-5年',
            date: '26天'
          }
        ]
      },
      {
        rowKey: 22,
        name: '交互设计/用户体验',
        leader: '郑十',
        createTime: '2018-07-24',
        expr: '',
        date: '26天',
        children: [
          {
            rowKey: 221,
            name: '交互设计师',
            leader: '郑小⑩',
            createTime: '2018-07-24',
            expr: '5-10年',
            date: '24天'
          }
        ]
      }
    ]
  }
]

export default data

props

| props | 说明 | | ------------------------ | ---------------------------------------------- | | tableData | 表格数据 | | columns | 表头配置,参考el-table Table-column Attributes | | rowKey | 必须,默认为id | | hasPagination | 是否需要分页,默认为true | | currentPage | 当前页 hasPagination=true为必须 | | pageSize | pageSize, hasPagination=true为必须 | | total | hasPagination=true为必须 | | paginationProps | 其他Pagination配置项 参考el-pagination组件 | | needReverse | 是否需要保持分页里每一个页面的选中和折叠状态 | | 其他参数配置参考el-table | |

events

| 事件 | 说明 | 参数 | | ------------- | ------------------------------------ | --------------------------------------- | | select | checkbox点击后发出的事件,同el-table | selections, selectionIds, row | | select-all | 同el-table | selections, selectionIds, isAllSelected | | select-change | | selections, selectionIds | | | 其他表格事件参考el-table | | | | 其他分页事件参考el-pagination | |