Giter Site home page Giter Site logo

vue-table's Introduction

vue-pagination-table

基于element-ui 2次封装的table + 分页 组件

安装

$ npm install vue-pagination-table -S

使用

main.js 文件中引入插件并注册

# main.js
// 因为是基于 element-ui 所以此处要引入
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import vueTable from 'vue-pagination-table'
Vue.use(ElementUI)
Vue.use(vueTable)

在项目中使用 vue-pagination-table

<template>
  <common-table
  :tableData="tableData"
  :columnData="columnData"
  @clickTable="clickTable"
  :height="tableHeight"
></common-table>
</template>
<script>
  export default {
    data () {
      return {
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }],
        columnData: [
          {
            prop: 'date', // 对应tableData的date
            label: '日期', // 表头标题
            sortable: true // 是否可排序
          },
          {
            prop: 'name',
            label: '名字'
          },
          {
            prop: 'address',
            label: '地址'
          }
        ],
        tableHeight: 1000   // 单位是px
      }
    },
    methods: {
      // 点击table的事件
      clickTable (data) {
        console.log(data)
      }
    }
  }
</script>

特点

  1. 简单易用,table + 分页 的整合
  2. 提供以 npm 的形式安装提供全局组件,
  3. 大家如果还有其它想加的需求,欢迎提issue

vue-table's People

Contributors

dependabot[bot] avatar gdutwyg avatar

Watchers

 avatar  avatar

Forkers

136shine

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.