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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-canvas-table

v1.0.3

Published

使用Canvas实现的表格组件,数据量大的情况下与使用标签实现的表格控件相比速度会更快

Readme

vue-canvas-table

使用Canvas实现的表格组件,数据量大的情况下与使用标签实现的表格控件相比速度会更快

安装

npm i vue-canvas-table -S

使用

<template>
    ...
        <VueCanvasTable :config="options" @click="onClcik" />
    ...
</template>
<script>
import Vue from 'vue'
import VueCanvasTable from 'vue-canvas-table'
export default{
    componets:{
        VueCanvasTable
    },
    data(){
        return {
            options:{
                ...
            }
        }
    },
    methods:{
        onClick(data){
            ...
        }
    }
}
</script>

示例

npm install
npm run dev

选项

{
  source: { // 数据源
    columns: ['暂无数据'],
    datas: []
  },
  width: 0, // canvas宽度
  height: 0, // canvas高度
  cellMaxWidth: 0, // 最大单元格宽度,默认屏幕1/3
  paddingLR: 22, // 左右内间距
  paddingTB: 22, // 上下内间距
  lineHeight: 8,    // 多行文字行高
  fontSize: 16, // 字体大小
  fontColor: '#333333', // 字体颜色
  fontFamily: 'Microsoft YaHei',    // 字体
  sliderColor: 'rgba(0, 0, 0,.3)',  // 滑块颜色
  lineColor: '#ededed', // 表格分割线颜色
  lockRows: 1, // 锁定1行
  lockColumns: 1, // 锁定1列
  to2DArr(source) { // 把source转换成二维数组
    let arr = []
    arr.push(source.columns)
    source.datas.forEach(row => {
      arr.push(row.columns)
    })
    return arr
  },
  index2Data(row, col) { // 行列索引转换成与source对应的数据
    if (row === 0) {
      return {
        row,
        col,
        rowData: this.source.columns,
        colData: this.source.columns[col]
      }
    } else {
      return {
        row,
        col,
        rowData: this.source.datas[row - 1],
        colData: this.source.datas[row - 1].columns[col]
      }
    }
  },
  setCellOpts(row, col, data) { // 设置单元格参数
    if (row === 0) {
      return {
        color: '#F8F8F8'
      }
    } else {
      if (data.rowData.clickAble === false) {
        return {
          color: '#F8F8F8'
        }
      } else {
        return {
          arrow: true,
          color: '#FFFFFF'
        }
      }
    }
  }
}