x-data-spreadsheet一款web表格插件

1.缺点

  1. ie浏览器不支持
  2. 目前不能配置多个sheet
  3. 不会自动添加列

2.优点

  1. 可编辑表格
  2. 可导出相应格式化数据
  3. 可校验
  4. 结合web页面操作简单方便

3.使用

npm install x-data-spreadsheet
<div id="x-spreadsheet-demo"></div>
import Spreadsheet from "x-data-spreadsheet";
// If you need to override the default options, you can set the override
// const options = {};
// new Spreadsheet('#x-spreadsheet-demo', options);
const s = new Spreadsheet("#x-spreadsheet-demo")
  .loadData({}) // load data
  .change(data => {
    // save data to db
  });

// data validation
s.validate()
配置项
// default options
{
  showToolbar: true,
  showGrid: true,
  showContextmenu: true,
  view: {
    height: () => document.documentElement.clientHeight,
    width: () => document.documentElement.clientWidth,
  },
  row: {
    len: 100,
    height: 25,
  },
  col: {
    len: 26,
    width: 100,
    indexWidth: 60,
    minWidth: 60,
  },
  style: {
    bgcolor: '#ffffff',
    align: 'left',
    valign: 'middle',
    textwrap: false,
    strike: false,
    underline: false,
    color: '#0a0a0a',
    font: {
      name: 'Helvetica',
      size: 10,
      bold: false,
      italic: false,
    },
  },
}
发布了22 篇原创文章 · 获赞 2 · 访问量 2873

猜你喜欢

转载自blog.csdn.net/gaodda/article/details/99452411