1.0.5 • Published 4 years ago
vvv-type v1.0.5
Vue input type
Install
yarn add vvv-type
npm i -S vvv-type
Local (as directive)
import typeMask from 'vvv-type';
export default function (el, binding) {
typeMask(el, binding);
}
Example
<input
v-model="field"
v-type="{
name: 'float',
maxLength: 5
}"
/>
Default types
'float': /^\d*\.?\d*/
'number': /\d*/
'word': /[A-zА-я]*\s?/g
'ruWord': /[А-я]\s*/g
'enWord': /[А-я]\s*/g
Custom types
import typeMask from 'vvv-type';
const customTypes = {
'float': /^\d*\.?\d*/,
'number': /\d*/,
'any': /.*/,
'lowCase': /[а-я]/g
}
export default function (el, binding) {
typeMask(el, binding, customTypes);
}