0.0.4-alpha.3 • Published 4 years ago
@satrong/v-input v0.0.4-alpha.3
A Vue directive to control HTML input/textarea element value. Support Vue 2 and Vue 3.
Installation
npm install @satrong/v-inputFor Vue 2.x:
import Vue from 'vue'
import vInput from '@satrong/v-input'
Vue.use(vInput)
new Vue({
// ...
}).$mount('#app')For Vue 3.x:
import { createApp } from 'vue'
import vInput from '@satrong/v-input'
createApp({
// ...
}).use(vInput).mount('#app')Usage
The format is as follow:
<input v-model="arg" v-input:arg.modifier="bindValue" />Example:
<template>
<div>
<input v-model="age" v-input:age.postive.integer="[0,80]">
<input v-model="form.total" v-input:form:total.number>
</div>
</template>
<script>
export default {
data() {
return {
age: '',
form: {
total: ''
}
}
}
}
</script>arg
Corresponding to the value of v-model , replace . with : when the value include . .
For example, the value is a.b.c (ie. v-model="a.b.c" ), and the arg should be a:b:c (ie. v-input:a:b:c).
modifier
numberAny number stringintegerpositivenegative!0Not zero
bindValue
[min, max]Limit the value range. Trigger by blur event.(val) => stringCustom function. ⚠ DONOT RETURN DYNAMIC VALUE
0.0.4-alpha.3
4 years ago
0.0.4-alpha.2
4 years ago
0.0.4-alpha.1
4 years ago
0.0.4-alpha.0
4 years ago
0.0.2
4 years ago