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

table-mixin

v1.0.7

Published

#### 介绍

Downloads

2

Readme

table-mixin

介绍

一款简单的列表数据处理 mixin。

安装

  1. npm
npm i table-mixin
  1. browser
<script src="https://unpkg.com/table-mixin/dist/index.umd.js"></script>

data

| 参数 | 类型 | 是否必须 | 可选值 | 默认值 | 说明 | | ----------------------------- | ------- | -------- | ------ | ------ | ------------------------------- | | tableId | string | 是 | - | - | 列表唯一标识以及 ref | | tableForm | object | 否 | - | {} | 列表查询条件 | | tableSize | string | 否 | - | | 列表尺寸 | | tableColumns | array | 否 | - | [] | 列表表头 columns[] | | tableCheckedColumns | array | 否 | - | [] | 列表当前展示的列属性集合 prop[] | | tableColumnsWidth | object | 否 | - | {} | 列表列宽 { prop: width } | | tableSortProp | string | 否 | - | - | 列表排序的列属性 | | tableSortOrder | string | 否 | - | - | 列表排序的方式 | | tableLoading | boolean | 否 | - | false | 列表请求状态 | | tablePageNum | number | 否 | - | 1 | 列表分页页码 | | tablePageSize | number | 否 | - | 20 | 列表分页大小 | | tableTotal | number | 否 | - | 0 | 列表条总数 | | tableData | array | 否 | - | [] | 列表数据 | | tableSelectedRows | array | 否 | - | [] | 列表当前选中数据 | | tableCurrentRow | object | 否 | - | null | 列表当前行数据 | | tableExcludeStorageProperties | array | 否 | - | [] | 列表排除本地存储数据字段 |

computed

| 参数 | 类型 | 说明 | | ------------------- | ----- | -------------------------- | | tableVisibleColumns | array | 列表当前展示的列 cloumns[] |

methods

tableRemoteMethod

列表远程请求数据 API。

| 参数 | 类型 | 是否必须 | 说明 | | ---- | ------- | -------- | ---- | | - | Promise | 是 | - |

tableBeforeRequestCallback

列表远程请求前的方法,一般用于请求参数校验。

| 参数 | 类型 | 是否必须 | 说明 | | ---- | -------- | -------- | ----------------------- | | fn | function | 否 | fn 为 tableRemoteMethod |

tableSuccessCallback

列表请求成功后的回调。

| 参数 | 类型 | 是否必须 | 说明 | | ---- | ---- | -------- | --------------------------------------------- | | res | - | 否 | res 为 tableRemoteMethod 请求成功后返回的数据 |

tableErrorCallback

列表请求失败后的回调。

| 参数 | 类型 | 是否必须 | 说明 | | ----- | ---- | -------- | --------------------------------------------------- | | error | - | 否 | error 为 tableRemoteMethod 请求成功失败后的错误信息 |

refreshTable

刷新列表,该方法会将 tablePageNum 重置为 1 再进行刷新。

| 参数 | 类型 | 是否必须 | 说明 | | ------ | ---- | -------- | --------------------------------------------------------- | | params | - | 否 | params 为需要重置的查询条件,如果没有则沿用上一次查询条件 |

getTableData

请求列表数据。该方法只刷新当前页。

setTablePageNum

设置分页页码。

| 参数 | 类型 | 是否必须 | 说明 | | ------- | ------ | -------- | ---- | | pageNum | number | 是 | - |

setTablePageSize

设置分页大小。

| 参数 | 类型 | 是否必须 | 说明 | | -------- | ------ | -------- | ---- | | pageSize | number | 是 | - |

setTableSize

设置表格尺寸

| 参数 | 类型 | 是否必须 | 说明 | | ---- | ------ | -------- | ---- | | size | number | 是 | - |

setTableSelectedRows

处理表格选中状态改变

| 参数 | 类型 | 是否必须 | 说明 | | ---- | ----- | -------- | ---- | | rows | array | 是 | - |

setTableCheckedColumns

设置列表表头展示

| 参数 | 类型 | 是否必须 | 说明 | | ------ | ----- | -------- | ---- | | prop[] | array | 是 | - |

setTableColumnWidth

设置列表列宽

| 参数 | 类型 | 是否必须 | 说明 | | ---------------------------- | ---- | -------- | ---- | | (newWidth, oldWidth, column) | - | 否 | - |

setTableSort

设置列表排序

| 参数 | 类型 | 是否必须 | 说明 | | ------------- | ---- | -------- | ---- | | {prop, order} | - | 否 | - |

getTableStorage

从 LocalStorage 中获取列表信息。

setTableStorage

将列表信息存储至 LocalStorage。

setTableLayout

列表重新布局