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

@wangankeji/vue-rolltable

v0.3.1

Published

Roll table for Vue2

Downloads

1

Readme

roll-table

基于 Vue2 的滚动表格。

安装

yarn add @wangankeji/vue-rolltable

用法


<template>
  <roll-table :data="data" :cols="cols"/>
</template>
<script>
import RollTable from '@wangankeji/vue-rolltable'

export default {
  components: {RollTable},
  data() {
    return {
      cols: [{
        title: 'ID',
        field: 'id',
        component: 'YourComponent'
      }, ...{}]
    }
  }
}
</script>

属性

|名称|类型|默认值|描述| |---|---|---|---| |cols|array|-|列定义。详见 列定义| |data|array|-|数据| |show-header|boolean|true|是否显示表头| |header-size|string|32px|表头高度| |interval|number|5000|滚动时间间隔,单位为 毫秒,设置为0以禁用滚动| |name|string|clip|动画名称。详见 动画| |duration|number|1000|动画时长,单位为 毫秒,设置为0以禁用动画| |func|string|ease-in|动画函数名称,其用于指定 animation-timing-function| |row-gap|string|0|指定行间距| |row-class|string/array/object/function|-|行的样式| |row-component|string/object/Vue|-|自定义行渲染组件| |row-height|string|-|指定行高| |no-wrap|boolean|false|单元格内容强制不换行| |header-style|string/object|-|表头样式| |header-class|string/object/array|-|表头样式类|

row-class 为函数时的参数:

e = {
  data: Array,
  row: Object,
  rowIndex: Number
}

列定义

表格由多个列组成,每个列的定义如下:

|名称|类型|描述| |---|---|---| |field|string|字段名称| |title|string|标题(可选)| |align|string|内容列对齐方式,可选值为 left/center/right,不指定时为 left(可选)| |headerAlign|string|头部列对齐方式,不指定时为 center(可选)| |width|string/number|列宽度(可选)| |style|object|内容列的样式定义(可选)| |headerStyle|object|标题列的样式定义(可选)| |component|string/object/Vue|自定义渲染组件(可选)| |render|function|自定义渲染html(可选)|

width 当有列未指定宽度时,那么这些列平分剩下的宽度。

component 用于使用自定义组件来渲染某个单元格,应当包含以下属性(Props):

const YourComponent = {
  props: {
    column: Object,
    data: Array,
    row: Object,
    rowIndex: Number,
    colIndex: Number,
    value: Any
  }
}

render 用于自定义 html 渲染单元格,其参数为一个对象,结构如下:

e = {
  column: Object,
  data: Array,
  row: Object,
  rowIndex: Number,
  colIndex: Number,
  value: Any
}

render 应该始终返回一个字符串。

  • data 行数据对象
  • column 列定义
  • rowIndex 行号
  • colIndex 列号
  • value 为单元格的值

动画

组件内置了一些动画:

  • top
  • left
  • right
  • opacity
  • height
  • scale
  • top-shake
  • clip
  • fall

这些名称作为属性值传给 <roll-table animation-name="clip" />

也可以自定义动画,只需要将自定义动画的名称直接传给 animation-name 即可。

自定义动画名称不得与内置名称重复。

如:


<template>
  <roll-table animation-name="your-animation"/>
</template>
<style>
@keyframes your-animation {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
</style>