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

vue-table2

v1.0.4

Published

veu vue-table vue-component

Downloads

5

Readme

vue-table

a table component for vue2.0

在做业务组件的时候需要自己自己封装一个通用的表格,这个表格需要符合我们一切的好的幻想,左右固定,表头固定,分页,选择,一直表格内容的行数限制等等,下面就为大家介绍一下这一款表格组件功能以及怎么使用。

install

npm install vue-table2

基本使用

    import vueTable from 'vue-table2'
   
    <vue-table :tdata="tableData"
    		   :tcolumns="tableColumns"
    		   :showHandle="true"
    		   :tdHeight="40"
    		   v-on:clickItem="tableSelectItem">
    	<template slot="operations" scope="scope">
    		<span @click="edit(scope.item)">编辑</span>
    		<span @click="edit(scope.item)">删除</span>
    		<span @click="edit(scope.item)">禁用</span>
    	</template>
    </vue-table>
	
	/*
	const columns1 = [
    {
      title: '机构编号',
      key: 'number',
      width: 85,
      textAlign: 'left'
    },
    {
      title: '机构名称',
      key: 'name',
      width: 292,
      textAlign: 'left',
      textLine: 2,
      selectText: true
    },
    {
      title: '类型',
      key: 'type',
      width: 180,
      textAlign: 'center'
    },
    {
      title: '状态',
      key: 'brand',
      width: 82,
      textAlign: 'center'
    }
  ]
	*/
	请看下面的说明

列的配置(columns)

| 名称 | 默认 | 是否必须 | 说明 | | ------------ | ------------ | ------------ | ------------ | | title | | 是 | 表头标题 | | key | | 是 | 数据的 key 值 | | width | | 是 | 列的宽度以及最小宽度 | | textLine | | 否 | 指定那一列的单元格文子溢出显示省略号 | | textAlign | left | 否 | 指定那一列的单元格文字的对齐方式left(左对齐) center( 居中) right(右对齐) |

表格组件的属性配置说明(table config)

| 名称 | 类型 | 默认 | 是否必须 | 说明 | | ------------ | ------------ | ------------ | ------------ | ------------ | | tdata | Array | | 是 | 渲染表格的数据 | | tcolumns | Array | | 是 | 表格列的配置 | | showSelect | Boolean | false | 否 | 是否显示左侧选择框 | | showHandle | Boolean | false | 否 | 是否显示右侧操作内容 | | titleHeight | Number | 32 | 否 | 表头高度 | | tdHeight | Number | 50 | 否 | 单元格高度 | | titleFixed | String | 'auto' | 否 | 表头是否固定,默认'auto'(不固定),'fixed'(固定),注意:表头固定需指定滚动内容(scrollHight)的高度 | | scrollHight | Numer | 400 | 否 | 滚动内容的高度 | | selectFixed | Boolean | false | 否 | 左侧是否固定 | | handleFixed | Boolean | false | 否 | 右侧是否固定 | | page | Object | | 否 | 不配置这个 page 就不显示 底部页码,配置的话{totalPage: 50,maxSize: 5} (totalPage)总页数 ,(maxSize)显示页数 |

事件相关

| 名称 | 是否必须 | 说明 | | ------------ | ------------ | ------------ | | clickItem | 否 | 点击每一行时候触发的事件 | | changePage | 否 | 页码改变时触发的事件 | | selectCheck | 否 | 选择左边 chebox 时候触发的事件 |

slot 说明

操作的模板 slot

    <template slot="operations" scope="scope">
    	<span @click="edit(scope.item)">编辑</span>
    	<span @click="edit(scope.item)">删除</span>
    	<span @click="edit(scope.item)">禁用</span>
    </template>
	

ps:如果觉得对你有用的话 请点一个 start,你的支持我才是最大的动力