Giter VIP home page Giter VIP logo

solocao / vue3-table-lite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linmasahiro/vue3-table-lite

0.0 0.0 0.0 1.71 MB

A simple and lightweight data table component for Vue.js 3. Features sorting, paging, row check, dynamic data rendering, supported TypeScript, and more.

Home Page: https://linmasahiro.github.io/vue3-table-lite/dist/

License: MIT License

JavaScript 0.75% TypeScript 0.81% HTML 37.29% Vue 61.16%

vue3-table-lite's Introduction

vue3-table-lite

Lincense NPM GitHub release (latest by date) Website npm

GitHub Repo stars GitHub forks

SampleGif

A simple and lightweight data table component for Vue.js 3. Features sorting, paging, row check, dynamic data rendering, supported TypeScript, and more.

Document and demo

Document

Online Demo

Support

  • Row check event Support
  • Custom data display Support
  • Pagging Support
  • Sorting Support
  • Custom message Support
  • V-slot Support
  • TypeScript Support

SampleCode

import

import TableLite from "vue3-table-lite";
import TableLite from "vue3-table-lite/ts"; // TypeScript

QuickStart

component

<table-lite
:is-loading="table.isLoading"
:columns="table.columns"
:rows="table.rows"
:total="table.totalRecordCount"
:sortable="table.sortable"
:messages="table.messages"
@do-search="doSearch"
@is-finished="table.isLoading = false"
/>

data

const table = reactive({
  isLoading: false,
  columns: [
    {
      label: "ID",
      field: "id",
      width: "3%",
      sortable: true,
      isKey: true,
    },
    {
      label: "Name",
      field: "name",
      width: "10%",
      sortable: true,
    },
    {
      label: "Email",
      field: "email",
      width: "15%",
      sortable: true,
    },
  ],
  rows: [],
  totalRecordCount: 0,
  sortable: {
    order: "id",
    sort: "asc",
  },
});

Event

const doSearch = (offset, limit, order, sort) => {
  table.isLoading = true;

  // Start use axios to get data from Server
  let url = 'https://www.example.com/api/some_endpoint?offset=' + offset + '&limit=' + limit + '&order=' + order + '&sort=' + sort;
  axios.get(url)
  .then((response) => {
    // Point: your response is like it on this example.
    //   {
    //   rows: [{
    //     id: 1,
    //     name: 'jack',
    //     email: '[email protected]'
    //   },{
    //     id: 2,
    //     name: 'rose',
    //     email: '[email protected]'
    //   }],
    //   count: 2,
    //   ...something
    // }
    
    // refresh table rows
    table.rows = response.rows;
    table.totalRecordCount = response.count;
    table.sortable.order = order;
    table.sortable.sort = sort;
  });
  // End use axios to get data from Server
};

More...

Go to Check!!

release

ver 1.2.0 : Added Row click event `#41`
ver 1.1.9 : New Features `#35` `#36`
ver 1.1.8-1 : Removed unnecessary style-class and changed something class-name `#33`
ver 1.1.8 : Add option to set header/column class and style(in-line) `#32`
ver 1.1.7 : Add option to set custom values in page size dropdown `#29`
ver 1.1.6 : fixed bug. `#28`
ver 1.1.5 : Added classes to element for easier Styling. `#25`
ver 1.1.3 : fixed cannot get localTabel refs bugs.
ver 1.1.2 : changed import file on TypeScript.
ver 1.1.1 : added hide-paging and page number attribute and fixed `#23`.
ver 1.1.0 : remove Vue Dependency at bundle
ver 1.0.9 : column v-slot is not to be required on v-slot mode
ver 1.0.8 : fixed can't rendering customized display data on static mode bus.
ver 1.0.7 : support v-slot.
ver 1.0.6 : support static mode.
ver 1.0.5 : fixed Safari loading-mask is not overlapping the table.
ver 1.0.4 : support TypeScript.
ver 1.0.3 : fixed wrong limit value.

vue3-table-lite's People

Contributors

grafxflow avatar klemens189 avatar linmasahiro avatar wattsie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.