mirror of
https://github.com/tenrok/maska.git
synced 2026-05-15 11:59:38 +03:00
cd1e9f3564
- new directive format: pass options as value, bound as argument with modifiers - update and checkValue methods in MaskInput
45 lines
774 B
Vue
45 lines
774 B
Vue
<script setup lang="ts">
|
|
import { reactive, ref } from 'vue'
|
|
import { vMaska } from '../../src'
|
|
|
|
const emit = defineEmits(['mask1', 'mask2'])
|
|
|
|
const isEager = ref(false)
|
|
|
|
const value1 = ref('123')
|
|
const value2 = ref('321')
|
|
|
|
const options = reactive({
|
|
eager: isEager,
|
|
onMaska: () => null
|
|
})
|
|
|
|
const onMaska1 = () => {
|
|
emit('mask1')
|
|
}
|
|
|
|
const onMaska2 = () => {
|
|
emit('mask2')
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<input id="checkbox" type="checkbox" v-model="isEager" />
|
|
<input
|
|
id="input1"
|
|
v-maska="options"
|
|
data-maska="#-#"
|
|
v-model="value1"
|
|
@maska="onMaska1"
|
|
/>
|
|
<input
|
|
id="input2"
|
|
v-maska
|
|
data-maska="#-#"
|
|
v-model="value2"
|
|
@maska="onMaska2"
|
|
/>
|
|
<div id="value1">{{ value1 }}</div>
|
|
<div id="value2">{{ value2 }}</div>
|
|
</template>
|