2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-02 16:04:05 +03:00

feat!: rework for v3

- new directive format: pass options as value, bound as argument with modifiers
- update and checkValue methods in MaskInput
This commit is contained in:
Alexander Shabunevich
2024-03-30 12:39:22 +03:00
parent fe2dc8a766
commit cd1e9f3564
15 changed files with 188 additions and 199 deletions
+8 -12
View File
@@ -1,24 +1,20 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { MaskaDetail, vMaska } from '../../src'
import { MaskInputOptions, vMaska } from '../../src'
const emit = defineEmits(['mask1', 'mask2', 'mask3'])
const bound1 = reactive({})
const bound2 = reactive({})
const options1 = {
onMaska: (detail: MaskaDetail) => emit('mask1', detail)
const options1 = <MaskInputOptions>{
onMaska: (detail) => emit('mask1', detail)
}
const options2 = {
const options2 = <MaskInputOptions>{
onMaska: [
(detail: MaskaDetail) => emit('mask2', detail),
(detail: MaskaDetail) => emit('mask3', detail),
(detail) => emit('mask2', detail),
(detail) => emit('mask3', detail),
]
}
</script>
<template>
<input id="input1" v-maska:[options1]="bound1" data-maska="#-#" />
<input id="input2" v-maska:[options2]="bound2" data-maska="#-#" />
<input id="input1" v-maska="options1" data-maska="#-#" />
<input id="input2" v-maska="options2" data-maska="#-#" />
</template>