New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vxe-table

Package Overview
Dependencies
Maintainers
1
Versions
2020
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vxe-table

A very powerful Vue table component.

  • 0.0.1-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
increased by119.59%
Maintainers
1
Weekly downloads
 
Created
Source

vxe-table

A very powerful Vue table component.

Features

  • vxe-table 功能点

Installing

npm install xe-utils vxe-table

Get on unpkg and cdnjs

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/vxe-table/lib/index.css">
<!-- 引入脚本 -->
<script src="https://unpkg.com/xe-utils"></script>
<script src="https://unpkg.com/vxe-table"></script>
import Vue from 'vue'
import VXETable from 'vxe-table'

// Case 1. 引入默认的样式
import 'vxe-table/lib/index.css'

// Case 2. 自定义表格颜色(复制 src/style/variable.scss 到自己的项目中,修改颜色变量,然后引入)
// @import 'assets/style/vxe-table/variable.scss';
// @import 'vxe-table/style/table.scss';

// Case 3. 重写主题样式(复制 src/style/table.scss 到项目中自行修改)
// @import 'assets/style/vxe-table/variable.scss';
// @import 'assets/style/vxe-table/table.scss';

Vue.use(VXETable)

API

Table

<vxe-table :data.sync="tableData">
  <vxe-table-column type="selection" width="60"></vxe-table-column>
  <vxe-table-column prop="name" label="Name"></vxe-table-column>
  <vxe-table-column prop="address" label="Address"></vxe-table-column>
</vxe-table>
Table Attributes
参数说明类型可选值默认值
data显示的数据Array
customs初始化绑定动态列Array
height初始化完整表格数据String
stripe是否带有斑马纹Booleanfalse
border是否带有纵向边框Booleanfalse
size表格的尺寸String
fit列的宽度是否自撑开Booleantrue
loading表格是否加载中Booleanfalse
show-header是否显示表头Booleantrue
highlight-current-row是否要高亮当前选中行Booleanfalse
highlight-hover-row鼠标移到行是否要高亮显示Booleantrue
row-key行数据的 KeyString
auto-width自动计算列宽(如果关闭,需要手动调用 computeWidth 方法)Booleantrue
Table Events
事件名说明参数
select-all只对 type=selection 有效,当手动勾选全选时触发的事件selection
cell-click当某个单元格被点击时会触发该事件{row,rowIndex,column,columnIndex,cell},event
cell-dblclick当某个单元格被双击时会触发该事件{row,rowIndex,column,columnIndex,cell},event
Table Methods
方法名描述参数
reload初始化数据data
clearSelection用于多选表格,清空用户的选择
clearSelectRow用于单选表格,清空用户的选择
clearSort用于清空排序条件,数据会恢复成未排序的状态
computeWidth重新计算并更新列宽

Table-column

<vxe-table-column prop="name" label="Name"></vxe-table-column>
Table-column Attributes 参数
参数说明类型可选值默认值
type列的类型Stringindex / selection / radio
prop列属性String
label列标题String
width列宽度String
minWidth最小列宽度,把剩余宽度按比例分配String
fixed将列固定在左侧或者右侧Stringleft
align列对其方式Stringleft
header-align表头对齐方式String
ellipsis当内容过长时显示为省略号Booleanfalse
show-overflow-title当内容过长显示为省略号并用原生的 title 显示完整内容Booleanfalse
show-overflow-tooltip当内容过长显示为省略号并用 tooltip 显示完整内容Booleanfalse
formatter格式化显示内容 Function({cellValue, row, rowIndex, column, columnIndex})Function
indexMethod只对 type=index 有效,自定义索引方法 Function({row, rowIndex, column, columnIndex})Function
sortable是否允许列排序Boolean
sortBy只对 sortable 有效,自定义排序的属性String/Array
filters配置筛选条件数组Array
filterMultiple只对 filters 有效,筛选是否允许多选Booleantrue
filterMethod只对 filters 有效,自定义筛选方法Function
Table-column Scoped Slot
name说明
自定义显示内容,参数为 { row, rowIndex, column, columnIndex }
header自定义表头的内容,参数为 { column, columnIndex }

Example

<template>
  <div>
    <vxe-table :data.sync="tableData">
      <vxe-table-column type="index" width="60"></vxe-table-column>
      <vxe-table-column prop="name" label="Name"></vxe-table-column>
      <vxe-table-column prop="sex" label="Sex"></vxe-table-column>
      <vxe-table-column prop="address" label="Address"></vxe-table-column>
    </vxe-table>
  </div>
</template>

<script>
export default {
  data () {
    return {
      tableData: [{
        date: 1551322088449,
        name: 'Xu Liangzhan',
        sex: 'Man',
        address: 'Address'
      }]
    }
  }
}
</script>

License

Copyright (c) 2017-present, Xu Liangzhan

Keywords

FAQs

Package last updated on 26 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc