0.1.5 • Published 4 years ago

@forvue/vue-directives v0.1.5

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

@forvue/vue-directives

Vue directives

Build Status CircleCI npm version npm downloads npm downloads npm license PRs Welcome

Vue module for directives in your applications. Some of goals of this project worth noting include:

  • Be lightweight, powerful and easy to use
  • Supports Multi-parameter
  • Supports Vue 2.0

Table of Contents

Requirements

Installation

npm

$ npm i @forvue/vue-directives -S

yarn

$ yuarn add @forvue/vue-directives

CDN

CDN: https://unpkg.com/@forvue/vue-directives

Usage

Global Registration

main.js:

import Vue from 'vue'
import App from './App.vue'
import VueDirectives from '@forvue/vue-directives'

Vue.use(VueDirectives)

new Vue({
  el: 'body',
  components: {
    App
  }
})

Local Registration

XXX.vue

<template>
  <div class="hello">
    <input type="text" v-integer v-model="integer">
  </div>
</template>
<script >
  import {integer} from '@forvue/vue-directives'
  export default {
    data() {
      return {
         integer: '1'
      }
    },
    directives: {
      integer
    }
  }
</script>

CDN Registration

template:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
    <script src="https://unpkg.com/@forvue/vue-directives"></script>
    <title>VueDirectives</title>
</head>
<body>
<div id="app">
    <input v-model="number" v-integer type="text">
</div>
<script>
    window.onload=function(){
        Vue.use(VueDirectives)
        let vm=new Vue({
            el:'#app',
            data:{
                number: 2
            }
        })
    }
    // or CDN Registration
    window.onload=function(){
            let vm=new Vue({
                el:'#app',
                data:{
                    number: 2
                },
                directives: {
                    integer: VueDirectives.integer
                }
            })
        }
</script>
</body>
</html>

DirectivesOptions

v-integer.required.cover="{}"

keydescriptiondefaultoptionsmode
requiredNot emptyfalseBooleanmodifiers&value
coverOverflow CoveragefalseBooleanmodifiers&value
requireValueOverflow empty0Numbervalue
maxinput Maximum valueInfinityNumbervalue
mininput minimum value-InfinityNumbervalue
maxFiguresmax lengthInfinityNumbervalue
coverEventscan Overflow events['blur']Arrayvalue
warningEventswarning events['blur']Arrayvalue
tipFunwarning callbacknullFunctionvalue

Authors && Contributors

License

The MIT License

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago