vreg

1.0.1 • Public • Published

vreg

A Vue.js project

使用方式

// main.js
import vreg from 'vreg'
vreg(Vue)
 
// 自定义指令
// template
<div v-reg:basic="{rule: 'c', msg: 'error3', tag: 'c', test: c}"></div>
<input  v-model="a" v-reg:basic="{rule: 'a', msg: 'error1', tag: 'a', test: a}">
<button  v-reg:basic.check="{check: switch}" @click="ck">click me</button>
// basic   分组
// rule    规则
// msg     提示信息
// tag     分组下的子项
// test    需校验的字段
// check   表示这个是触发校验的开关
// switch  true / false  需要异步执行  不然不生效
【js使用方式】
import {check} from 'vreg/src/lib/rule.js'
export default {
  methods: {
    ck() {
      this.switch = true
      setTimeout(()=> {
        this.switch = false
      })
      if(check('basic')) {
        console.log('ok');
      }
    }
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i vreg

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • zooey1184