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 🙏

© 2025 – Pkg Stats / Ryan Hefner

z-table-vue-2

v1.3.5

Published

vue2.0 table

Downloads

7

Readme

VUE2.0 Table组件, 无内置样式,精简高效;

全局引入

1、安装 yarn add z-table-vue-2 或 npm install [email protected] --save

2、引入 import ZTable from 'z-table-vue-2'; Vue.use(ZTable);

3、使用

<z-table :data="tableData" border height="300" size="medium" stripe style="width: 100%">
    <z-column type="selection" width="55"></z-column>
    <z-column prop="date" label="日期" min-width="150" align="right"></z-column>
    <z-column></z-column>
    <z-column align="center"><template slot-scope="scope">{{ scope.$index }} - {{ scope.row.name }}</template></z-column>
    <z-column prop="name" label="姓名" min-width="180"></z-column>
    <z-column prop="address" label="地址" min-width="280" show-overflow-tooltip></z-column>
    <z-column label="操作" width="180">
        <template slot-scope="scope"><a>编辑</a></template>
    </z-column>
</z-table>

<script>
export default {
  name: "demo",
  data() {
    return {
      tableData: [
        {
          id: 8,
          date: "2023-03-03",
          name: "小明",
          num: 12,
          p: 1.21,
          address: "深圳",
          tag: "g",
        },
        {
          id: 9,
          date: "2023-03-06",
          name: "小张",
          num: 12,
          p: 1.21,
          address: "xxx",
          tag: "a",
        },
      ],
    };
  }
};
</script>

<style>
.z--table {
  position: relative;
  overflow: hidden;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
  width: 100%;
  max-width: 100%;
  font-size: 14px;
  color: #606266;
}
.z--table thead {
  color: #909399;
  font-weight: 500;
}
.z--table .cell {
  padding: 12px 10px;
  min-width: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  text-overflow: ellipsis;
  vertical-align: middle;
  position: relative;
  text-align: left;
  overflow: hidden;
  white-space: normal;
  word-break: break-all;
  line-height: 23px;
}
.z--table-fit {
  border-right: 0;
  border-bottom: 0;
}
.z--table th.gutter {
  width: 15px;
  border-right-width: 0;
  border-bottom-width: 0;
  padding: 0;
}
.z--table td.gutter {
  width: 0;
}

/* 居中对齐 */
.z--table .is-center .cell{
  text-align: center;
}
/* 右对齐 */
.z--table .is-right .cell{
  text-align: right;
}

.z--table .is-hidden > * {
  visibility: hidden;
}

/* 设置 size 尺寸 */
.z--table-medium td .cell,.z--table-medium th .cell {
  padding: 10px;
}
.z--table-small,.z--table-mini {
  font-size: 12px;
}
.z--table-small td .cell,.z--table-small th .cell {
  padding: 8px;
}
.z--table-mini td .cell,.z--table-mini th .cell {
  padding: 3px;
}
/* 设置 size 尺寸 End*/

.z--table tr {
  background-color: #fff;
}
.z--table td,
.z--table th {
  border-bottom: 1px solid #ebeef5;
}

.z--table th {
  overflow: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-color: #fff;
}
.z--table th > .cell {
  display: inline-block;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  position: relative;
  vertical-align: middle;
  padding-left: 10px;
  padding-right: 10px;
  width: 100%;
}
.z--table th > .cell.highlight {
  color: #409eff;
}
.z--table th.required > div::before {
  display: inline-block;
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d51;
  margin-right: 5px;
  vertical-align: middle;
}
.z--table td div {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.z--table .cell {
  -webkit-box-sizing: border-box;
}


.z--table .cell.z--tooltip {
  white-space: nowrap;
  min-width: 50px;
}

.z--table-border {
  border: 1px solid #ebeef5;
}


/* 无数据 */
.z--table-empty-block {
  min-height: 60px;
  text-align: center;
  width: 100%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.z--table-empty-text {
  line-height: 60px;
  width: 50%;
  color: #909399;
}
/* 为空时加上边线 */
.z--table-border::after,
.z--table::before {
  content: "";
  position: absolute;
  background-color: #ebeef5;
  z-index: 1;
}
.z--table-border::after{
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
}
.z--table::before {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
}
/* 为空时加上边线 End*/
/* 无数据 End*/


/* 设置边线border 样式 */
.z--table-border {
  border-right: none;
  border-bottom: none;
}
.z--table-border td,
.z--table-border th {
  border-right: 1px solid #ebeef5;
}
.z--table-border :first-child .cell {
  padding-left: 10px;
}
.z--table-border th.gutter:last-of-type {
  border-bottom: 1px solid #ebeef5;
  border-bottom-width: 1px;
}
.z--table-border th {
  border-bottom: 1px solid #ebeef5;
}
.z--table-hidden {
  visibility: hidden;
}

/* 头 主体 尾 默认100% */
.z--table-body-wrapper,
.z--table-footer-wrapper,
.z--table-header-wrapper {
  width: 100%;
}

/* 表尾 top */
.z--table-footer-wrapper {
  margin-top: -1px;
}
.z--table-footer-wrapper td {
  border-top: 1px solid #ebeef5;
}

/* fixed */
.z--table-body,
.z--table-footer,
.z--table-header {
  table-layout: fixed;
  border-collapse: separate;
}

/* 表头 表尾 hidden */
.z--table-footer-wrapper,
.z--table-header-wrapper {
  overflow: hidden;
}

/* 表头 表尾 td背景 */
.z--table-footer-wrapper tbody td,
.z--table-header-wrapper tbody td {
  background-color: #f5f7fa;
  color: #606266;
}

/* 没有滚动条时 hidden */
.z--table-body-wrapper {
  overflow: hidden;
  position: relative;
}
/* 有滚动条时 使用auto */
.z--table-scrollable-x .z--table-body-wrapper {
    overflow-x: auto;
}
.z--table-scrollable-y .z--table-body-wrapper{
  overflow-y:auto
}

.z--table .hidden-columns {
  visibility: hidden;
  position: absolute;
  z-index: -1;
}

/* 多级表头背景 */
.z--table thead.is-group th {
  background: #f5f7fa;
}

/* 有固定栏目 fixed时 */
.z--table-fixed,
.z--table-fixed-right {
  position: absolute;
  top: 0;
  left: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.12);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.12);
}
.z--table-fixed-right::before,
.z--table-fixed::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background-color: #ebeef5;
  z-index: 4;
}
.z--table-fixed-right-patch {
  position: absolute;
  top: -1px;
  right: 0;
  background-color: #fff;
}
.z--table-fixed-right {
  top: 0;
  left: auto;
  right: 0;
}
.z--table-fixed-right .z--table-fixed-body-wrapper,
.z--table-fixed-right .z--table-fixed-footer-wrapper,
.z--table-fixed-right .z--table-fixed-header-wrapper {
  left: auto;
  right: 0;
}
.z--table-fixed-header-wrapper {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
}
.z--table-fixed-footer-wrapper {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
}
.z--table-fixed-footer-wrapper tbody td {
  border-top: 1px solid #ebeef5;
  background-color: #f5f7fa;
  color: #606266;
}
.z--table-fixed-body-wrapper {
  position: absolute;
  left: 0;
  top: 37px;
  overflow: hidden;
  z-index: 3;
}

/* 有固定fixed时 设置最大高度 */
.z--table-fluid-height .z--table-fixed,
.z--table-fluid-height .z--table-fixed-right{
  bottom:0;
  overflow:hidden
}

/* 有固定fixed时 滚动到左右边时,取消shadow */
.z--table-body-wrapper.is-scrolling-left ~ .z--table-fixed,
.z--table-body-wrapper.is-scrolling-none ~ .z--table-fixed,
.z--table-body-wrapper.is-scrolling-none ~ .z--table-fixed-right,
.z--table-body-wrapper.is-scrolling-right ~ .z--table-fixed-right {
  -webkit-box-shadow: none;
  box-shadow: none;
}
/* 有固定fixed时 滚动到右边,提前加一条边线 */
.z--table .z--table-body-wrapper.is-scrolling-right ~ .z--table-fixed-right {
  border-left: 1px solid #ebeef5;
}
/* 有固定栏目的 hover */
.z--table tr.hover-row > td {
  background-color: #f5f7fa;
}

/* 排序 */
.z--table th.is-sortable {
  cursor: pointer;
}
.z--table .caret-wrapper {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  height: 16px;
  width: 24px;
  vertical-align: middle;
  cursor: pointer;
  overflow: initial;
  position: relative;
}
.z--table .sort-caret {
  width: 0;
  height: 0;
  border: 5px solid transparent;
  position: absolute;
  left: 7px;
}
.z--table .sort-caret.ascending {
  border-bottom-color: #c0c4cc;
  top: -4px;
}
.z--table .sort-caret.descending {
  border-top-color: #c0c4cc;
  bottom: -2px;
}
.z--table .ascending .sort-caret.ascending {
  border-bottom-color: #409eff;
}
.z--table .descending .sort-caret.descending {
  border-top-color: #409eff;
}
/* 排序 end */




/* 设置斑马纹 stripe */
.z--table-striped tr.z--table-row-striped td {
  background: #fafafa;
}
/* 设置斑马纹 stripe End*/


/*  hover */
.z--table-body tr:hover>td {
    background-color: #f5f7fa;
}
/* hover End*/

/* 单选 */
.z--table tr.current-row > td {
  background-color: #ecf5ff;
}

/* 拖动表格宽度时,显示线条 */
.z--table-resize-proxy {
  position: absolute;
  left: 200px;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid #ebeef5;
  z-index: 10;
}

/* 展开行 */
.z--table .z--icon-right {
  width: 0;
  height: 0;
  border: 5px solid transparent;
  position: absolute;
  bottom: 0;
}
.z--table .z--icon-right {
  border-left-color: #c0c4cc;
}
.z--table-expand-column .cell {
  padding: 0;
  text-align: center;
}
.z--table-expand-icon {
  position: relative;
  cursor: pointer;
  color: #666;
  font-size: 12px;
  -webkit-transition: -webkit-transform 0.2s ease-in-out;
  transition: -webkit-transform 0.2s ease-in-out;
  transition: transform 0.2s ease-in-out;
  transition: transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;
  height: 20px;
}
.z--table-expand-icon-expanded {
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
}
.z--table-expand-icon > .z--icon-right {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -5px;
  margin-top: -5px;
}
.z--table,.z--table-expanded-cell {
  background-color: #fff;
}
.z--table-expanded-cell[class*="cell"] {
  padding: 20px 60px;
}
.z--table-expanded-cell:hover {
  background-color: transparent !important;
}
/* 展开行 End*/

/* 设置多选时需要 */
.z-check-box-span {
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  margin: auto;
}

.z-check-box-span::before {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid #dcdfe6;
  border-radius: 2px;
  content: "";
}

.z-check-box-span.active::after {
  width: 12px;
  height: 12px;
  content: "";
  margin: auto;
}

.z-check-box-span.active::after {
  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAqUlEQVQY033PoUrDUQCF8d/VobhyQbkPsGdYGZhUGIhlQQxG4dalJYN7kLuyJmi2aV/2DcQwuBiuwSRo+QuGsVPPB+c7wZbEUvtY4ra3BdrDI85xGGKpA9zgruX000G7uMcl3nDcwwOGOMAslhqw6KA1zlpO7yGWOsIz+pjjCFN84KTl9AqhmzrFE/Y7xU+MW06rP+cdaDm94Arf+MLkP7Tp6XUs9WJT9ws1kC07ActjIgAAAABJRU5ErkJggg==)
    no-repeat center;
}
/* 多选 End*/



/* 设置:row-class-name="tableRowClassName"时需要;可将表格内容 highlight 显示,方便区分「成功、信息、警告、危险」等内容。  */
.z--table .warning-row td {
  background: oldlace !important;
}

.z--table .success-row td {
  background: #f0f9eb !important;
}

/* 有 table solt append 时 插入至表格最后一行之后的内容,如果需要对表格的内容进行无限滚动操作,可能需要用到这个 slot。若表格有合计行,该 slot 会位于合计行之上。 */
.z--table-append-wrapper {
  overflow: hidden;
  padding: 12px;
  text-align: center;
}
.z--table-append-gutter {
  padding: 12px;
}