• Stars
    star
    100
  • Rank 340,703 (Top 7 %)
  • Language Vue
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple table component based Vue 2.x: https://dwqs.github.io/v2-table/

build pass npm-version license

ไธญๆ–‡ README

v2-table

A simple table component based Vue 2.x.

Installation

Install the pkg with npm:

npm i --save v2-table beautify-scrollbar

or yarn

yarn add  v2-table beautify-scrollbar

Get Started

import Vue from 'vue';

import 'beautify-scrollbar/dist/index.css'; 
import 'v2-table/dist/index.css'; 
import V2Table from 'v2-table';

Vue.use(V2Table)
<template>
  <v2-table :data="list">
    <v2-table-column label="Name" prop="name"></v2-table-column>
    <v2-table-column label="Date" prop="date"></v2-table-column>
    <v2-table-column label="Address" prop="address"></v2-table-column>  
  </v2-table>  
</template>

<script>
  export default {
    data () {
      return {
        list: [{
          date: '2017-12-02',
          name: 'test1',
          address: 'Shenzhen,China'
        }, {
          date: '2017-11-02',
          name: 'test2',
          address: 'Guangzhou,China'
        }, {
          date: '2018-01-02',
          name: 'test3',
          address: 'Shaoyang,Hunan'
        }, {
          date: '2017-10-02',
          name: 'test4',
          address: 'Changsha,Hunan'
        }]
      }
    }
  }
</script>

More demo to visit here.

Available Props

The v2-table component

Attribute Type Accepted Values Default Description
data Array - [] table data
border Boolean - false whether show table border
stripe Boolean - false whether table is striped
loading Boolean - false show loading component
empty-text String - No Data Displayed text when data is empty. You can customize this area with slot="empty"
default-sort Object order: ascending/descending if prop is set, and order is not set, then order is default to ascending set the default sort column and order. property prop is used to set default sort column, property order is used to set default sort order
row-class-name String/Function({row, rowIndex}) - - function that returns custom class names for a row, or a string assigning class names for every row
pagination-info Object - { text: '', pageSize: 10, nextPageText: 'Next', prevPageText: 'Prev' } pagination info for table data
shown-pagination Boolean - false whether showing pagination of table data
total Number - 0 all data of table, it's needed when shown-pagination is true
height Number/String - auto table's height
cell-height Number/String - 44 cell's height
show-summary Boolean - false whether to display a summary row
sum-text String - Sum displayed text for the first column of summary row
summary-method Function({ columns, data }) - - custom summary method
lazy-load Boolean - false whether enable lazy-load
col-height Number/String - 40 header columns' height

Table Events

Event Name Description Parameters
sort-change triggers when table's sorting changes { prop, order }
page-change triggers when table's page changes currentPage
select-change triggers when selection changes rows

Table Methods

Event Name Description Parameters
toggleRowSelection used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected row, selected
updateScrollbar update the scrollbar config for the table isReset(whether reset scrollbar, default value is false)

Table Slot

Name Description
empty custom empty component, it's will show when data is empty
loading custom loading component, it's will show when loading property of table is true

The v2-table-column component

Attribute Type Accepted Values Default Description
label String - - column label
prop String - - field name
width String/Number - - column width
sortable Boolean true/false false whether column can be sorted.
align String left/center/right center alignment
fixed String left/right - fixed column to left or right
type String - - type of the column
render-header Function(h, { column }) - - render function for table header of this column

Development

git clone git@github.com:dwqs/v2-table.git

cd v2-table

npm i 

npm run dev

Thanks

LICENSE

MIT

More Repositories

1

blog

๐Ÿถ ๐Ÿ‘ ๐ŸŒŸ Welcome to star
JavaScript
3,782
star
2

front-end-handbook

Front-end Developer HandBook. Read online: https://dwqs.gitbooks.io/frontenddevhandbook/content/
CSS
605
star
3

area-data

ไธญๅ›ฝ็œๅธ‚ๅŒบๆ•ฐๆฎ(ๅซๆธฏๆพณๅฐ)
JavaScript
482
star
4

vue-area-linkage

็œๅธ‚ๅŒบ่”ๅŠจ้€‰ๆ‹ฉ: https://dwqs.github.io/vue-area-linkage/
Vue
477
star
5

vue-to-react

๐Ÿ› ๏ธ ๐Ÿ‘‰ Try to transform Vue component to React component
JavaScript
431
star
6

area-puppeteer

ๅŸบไบŽ puppeteer ็š„ไธญๅ›ฝ่กŒๆ”ฟๅŒบๅŸŸๆŠ“ๅ–็ˆฌ่™ซ
JavaScript
169
star
7

react-style-guide

A mostly reasonable approach to React and JSX
157
star
8

vue-mobx

๐Ÿ˜„ โญ ๐Ÿ˜‡ Mobx binding for Vuejs 2.
TypeScript
110
star
9

js2excel

๐Ÿ˜Œ ๐Ÿ˜ƒ ๐Ÿ‘ฟ A simple module for excel and json converts each other, which works in the browser.
TypeScript
99
star
10

v2-datepicker

A simple datepicker component based Vue 2.x: https://dwqs.github.io/v2-datepicker/
JavaScript
90
star
11

tech-read

Grab tech articles daily from UGC communities
JavaScript
77
star
12

react-native-image-viewer

A pure JavaScript image viewer component for react-native apps with pan, pinch.etc, supporting both iOS and Android.
JavaScript
67
star
13

codewars-practices

Some best practices for practice questions on codewars, update it weekly
67
star
14

react-area-linkage

็œๅธ‚ๅŒบ่”ๅŠจ้€‰ๆ‹ฉ: https://dwqs.github.io/react-area-linkage/
JavaScript
61
star
15

react-virtual-list

A tiny virtualization list component(gzipped 6KB), supports dynamic height: https://dwqs.github.io/react-virtual-list/
JavaScript
46
star
16

vue-startup

A template with webpack 4 + vuejs 2 + + babel 7 setup for projects startup
JavaScript
43
star
17

chare

A simple CLI scaffolding for front-end projects
JavaScript
35
star
18

vue-resume

A Personal Resume Template is powered by Vue,Node.js & Webpack:http://resume.ido321.com
Vue
34
star
19

react-demos

Some react demos for myself: https://dwqs.github.io/react-demos
JavaScript
33
star
20

node-style-guide

A guide for styling your node.js / JavaScript code.
32
star
21

v2-lazy-list

A simple lazy-load list component based Vue 2.x: https://dwqs.github.io/v2-lazy-list/
JavaScript
31
star
22

mp-jithub

Mini program for Github
Vue
30
star
23

vue-typescript

A template with webpack 4 + vuejs 2 + typescript 2 setup for projects startup
TypeScript
27
star
24

revuejs

๐Ÿ‡ A tiny, light and handy state management for vuejs 2, writing less verbose code.
JavaScript
24
star
25

vue-toast

A toast component written with Vue, designed based on Ant Design [deprecated]
Vue
18
star
26

webpack-mpvue-startup

A template with webpack 3 + mpvue 1 setup for projects startup
JavaScript
14
star
27

beautify-scrollbar

Beautify browser's scrollbars: https://dwqs.github.io/beautify-scrollbar/index
JavaScript
13
star
28

lue

๐ŸŒฑ Vue and vuex based library, writing less verbose code.
JavaScript
12
star
29

mpvue-markdown-parser

A markdown parser for mpvue
JavaScript
9
star
30

nx

A hexo theme based on landscape-plus
CSS
9
star
31

babel-plugin-on-demand-import

Babel plugin for importing components on demand
JavaScript
9
star
32

react-startup

A template with webpack 4 + react 16 + react-router 4 + babel 7 setup for projects startup
JavaScript
8
star
33

chrome-extension-for-wiki

๐Ÿ” ๐Ÿฎ ๐Ÿผ Add awesome article link to your wiki repo on github quickly./ๅฟซ้€ŸๆทปๅŠ ๆ–‡็ซ ้“พๆŽฅๅˆฐ wiki repo ็š„ chrome ๆ‰ฉๅฑ•
JavaScript
7
star
34

async-await-error-handling

Error handling friendly for async/await in ts and js
JavaScript
7
star
35

reproto

A tool for generate simple random password which contains letters, number and special characters
JavaScript
6
star
36

icons

Some interesting icon & design implemented by pure css.
5
star
37

orbithub

A chrome extensition for convenient github search
JavaScript
5
star
38

redux-actions-promise

๐Ÿฐ ๐Ÿฑ ๐Ÿป FSA-compliant promise middleware for Redux, supports referencing dispatcher/state in action.
TypeScript
5
star
39

maoxuan

ๆ•™ๅ‘˜้€‰้›†้˜…่ฏป็ฌ”่ฎฐ
5
star
40

tiny-dom-helpers

๐ŸŒœ ๐ŸŒš ๐ŸŒ› Tiny dom helpers, supports IE9 +.
JavaScript
5
star
41

scroll-on-webview

ๅค„็† webview ไธŠ็š„ๆปšๅŠจ
JavaScript
4
star
42

infine

A chrome extension for theme color replacement of Github
CSS
4
star
43

note

Personal note sites, write what you want, support markdown: http://note.ido321.com/
JavaScript
3
star
44

view-star-packages-on-npm

View your star packages on npmjs.com: https://dwqs.github.io/view-star-packages-on-npm
JavaScript
3
star
45

async-react-compoment

๐Ÿ˜Ž ๐Ÿ‘€ ๐Ÿ™ˆ Async component loaded based webpack 3 for react-router 4.[unmaintained]
TypeScript
2
star
46

gitlang

Repository to list all programming languages github supports
JavaScript
2
star