4.0.0 • Published 4 months ago

vxe-table-plugin-validator v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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_ADDRESSIP地址
URLURL地址
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

4.0.0

4 months ago

1.0.1

8 months ago

3.0.0

8 months ago

1.0.0

8 months ago

0.0.1

10 months ago