vxe-table-plugin-validator
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

vxe-table-plugin-validator

gitee star npm version npm downloads npm license

基于 vxe-table 的表格插件,提供一些常用的校验

Compatibility

依赖 vxe-table v4 版本

Installing

npm install xe-utils vxe-table@next vxe-table-plugin-validator@next
// ...
import VXETable from 'vxe-table'
import VXETablePluginValidator from 'vxe-table-plugin-validator'
// ...

VXETable.use(VXETablePluginValidator)

API

Validator codes

code 编码 describe 描述 params 参数
MOBILE_NUMBER 手机号13位
EMAIL_ADDRESS 邮箱地址
IDENTITY_CARD 身份证号码
IP_ADDRESS IP地址
URL URL地址
PLATE_NUMBER 车牌号

Demo

<vxe-table
  :data="tableData"
  :edit-config="{trigger: 'click', mode: 'cell'}"
  :edit-rules="editRules">
  <vxe-column type="seq" width="60"></vxe-column>
  <vxe-column field="name" title="Name" :edit-render="{name: 'input'}"></vxe-column>
  <vxe-column field="mobile" title="Mobile" :edit-render="{name: 'input'}"></vxe-column>
  <vxe-column field="email" title="Email" :edit-render="{name: 'input'}"></vxe-column>
</vxe-table>
export default {
  data () {
    return {
      tableData: [
        { id: 100,  name: 'test1', mobile: '', email: '' },
        { id: 101,  name: 'test2', mobile: '', email: '' },
        { id: 102,  name: 'test3', mobile: '', email: '' }
      ],
      editRules: {
        mobile: [
          { required: true, validator: 'MOBILE_NUMBER' }
        ],
        email: [
          { required: true, validator: 'EMAIL_ADDRESS' }
        ]
      }
    }
  }
}

License

MIT License, 2019-present, Xu Liangzhan

Package Sidebar

Install

npm i vxe-table-plugin-validator

Weekly Downloads

2

Version

4.0.0

License

MIT

Unpacked Size

31.8 kB

Total Files

8

Last publish

Collaborators

  • x-extends