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

vue-snb-table

v2.6.6

Published

Display multiple data with similar format. You can sort your data in a table.

Downloads

6

Readme

English | 简体中文

vue-snb-table Table 表格

Table 表格. 用于展示多条结构类似的数据,可对数据进行排序操作。

GitHub stars Build Status GitHub issues GitHub forks GitHub last commit license NPM NPM

预览

https://cherislive.github.io/projrct/vue-snb-table/

页面预览: https://cherislive.github.io/projrct/vue-snb-table/

安装

$ npm install vue-snb-table

Import

Import using module

Import components to your project:

// in ES6 modules
import { SnbTable, SnbTableColumn, SnbTableHeader } from 'vue-snb-table';

// in CommonJS
const { SnbTable, SnbTableColumn, SnbTableHeader } = require('vue-snb-table');

// in Global variable
const { SnbTable, SnbTableColumn, SnbTableHeader } = VueSnbTable;

And register components:

Vue.component('snb-table', SnbTable);
Vue.component('snb-table-column', SnbTableColumn);
Vue.component('snb-table-header', SnbTableHeader);

Import using script tag

<script src="../node-modules/vue-snb-table/dist/index.js"></script>
const SnbTable = VueSnbTable.SnbTable;
const SnbTableColumn = VueSnbTable.SnbTableColumn;
const SnbTableHeader = VueSnbTable.SnbTableHeader;

new Vue({
  el: 'body',
  components: {
    'snb-table': SnbTable,
    'snb-table-column': SnbTableColumn,
    'snb-table-header': SnbTableHeader
  }
});

Usage

Work on a Vue instance:

<SnbTableHeader
  :columns="columns" 
  :colsWidth="colsWidth" 
/>
<snb-table>
  <snb-table-column prop="data1" label="data1" />
  <snb-table-column prop="data2" label="data2" />
  <snb-table-column prop="data3" label="data3">
    <template slot-scope="scope">{{scope.data3}}</template>
  </snb-table-column>
</snb-table>

Table

Attributes

| Option | Type | Description | Accepted Values | Default | | ----- | ----- | ----- | ----- | ----- | | data | Array | 显示的数据。 | - | - | | showHeader | Boolean | 是否显示表头。 | - | true | | headerFixed | Object | 固定表头。 | state: true/false | null | | defaultSort | Object | 默认的排序列的 prop 和顺序。它的prop属性指定默认的排序的列,order指定默认排序的顺序 | order: asc, desc | 如果只指定了prop, 没有指定order, 则默认顺序是ascending | | sortState | Object | 可以通过该属性设置排序列的 prop 和顺序。它的prop属性指定排序的列,order指定默认排序的顺序 | order: asc, desc | - | | headerColsWidth | Array | 表头各个列宽。 | - | - |

Events

| Event Name | Description | params | | ----- | ----- | ----- | | columnsReady | 当表格的列的数据状态加载完成的时候会触发该事件,该事件用于自定义表头的情况。 | columns | | sortChange | 当表格的排序条件发生变化的时候会触发该事件。 | {sort: {prop, order}, column} | | colsWidth | 当表格的数据发生变化的时候会触发该事件,返回各个列宽。 | widths | | distanXChange | 当拖动表格横向滚动的时候会触发该事件。 | width | | rowClick | 当某一行被点击时会触发该事件。| row |

Table-column

Attributes

| Option | Type | Description | Accepted Values | Default | | ----- | ----- | ----- | ----- | ----- | | prop | String | 对应列内容的字段名,也可以使用 property 属性。 | - | - | | label | String | 显示的标题。 | - | - | | align | String | 对齐方式。 | left/center/right | left | | width | String | 对应列的宽度。 | - | - | | fixed | String | 列是否固定在左侧。 | true, false | false | | sortable | Boolean | 对应列是否可以排序。 | true, false | false | | formatter | Function(row, column, cellValue, index) | 用来格式化内容。 | - | - |

Table-header

Attributes

| Option | Type | Description | Accepted Values | Default | | ----- | ----- | ----- | ----- | ----- | | columns | Array | 各个列属性。 | - | - | | colsWidth | Array | 各个列宽。 | - | - | | distanX | Number | 表格横向滚动的距离。 | left/center/right | left | | defaultSort | Object | 默认的排序列的 prop 和顺序。它的prop属性指定默认的排序的列,order指定默认排序的顺序 | order: asc, desc | 如果只指定了prop, 没有指定order, 则默认顺序是ascending | | sortState | Object | 可以通过该属性设置排序列的 prop 和顺序。它的prop属性指定排序的列,order指定默认排序的顺序 | order: asc, desc | - |

Events

| Event Name | Description | params | | ----- | ----- | ----- | | sortChange | 当表格的排序条件发生变化的时候会触发该事件。 | {sort: {prop, order}, column} | | headerColsWidth | 表头各个列宽。当表格的渲染完成的时候会触发该事件。 | widths |

Development

Watching with hot-reload:

$ npm run dev

Develop on real remote device:

$ npm run remote-dev {{ YOUR IP ADDRESS }}

License

MIT