mirror of
https://github.com/tenrok/maska.git
synced 2026-06-17 19:21:21 +03:00
Replace "binded" with "bound"
This commit is contained in:
+11
-11
@@ -153,15 +153,15 @@ import { reactive, ref } from "vue"
|
|||||||
import { vMaska } from "maska"
|
import { vMaska } from "maska"
|
||||||
|
|
||||||
const maskedValue = ref('')
|
const maskedValue = ref('')
|
||||||
const bindedObject = reactive({})
|
const boundObject = reactive({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="bindedObject" v-model="maskedValue">
|
<input v-maska="boundObject" v-model="maskedValue">
|
||||||
|
|
||||||
Masked value: {{ maskedValue }} or {{ bindedObject.masked }}
|
Masked value: {{ maskedValue }} or {{ boundObject.masked }}
|
||||||
Unmasked value: {{ bindedObject.unmasked }}
|
Unmasked value: {{ boundObject.unmasked }}
|
||||||
<span v-if="bindedObject.completed">✅ Mask completed</span>
|
<span v-if="boundObject.completed">✅ Mask completed</span>
|
||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ export default {
|
|||||||
directives: { maska: vMaska },
|
directives: { maska: vMaska },
|
||||||
data: () => ({
|
data: () => ({
|
||||||
maskedValue: "",
|
maskedValue: "",
|
||||||
bindedObject: {
|
boundObject: {
|
||||||
masked: "",
|
masked: "",
|
||||||
unmasked: "",
|
unmasked: "",
|
||||||
completed: false
|
completed: false
|
||||||
@@ -185,11 +185,11 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="bindedObject" v-model="maskedValue">
|
<input v-maska="boundObject" v-model="maskedValue">
|
||||||
|
|
||||||
Masked value: {{ maskedValue }} or {{ bindedObject.masked }}
|
Masked value: {{ maskedValue }} or {{ boundObject.masked }}
|
||||||
Unmasked value: {{ bindedObject.unmasked }}
|
Unmasked value: {{ boundObject.unmasked }}
|
||||||
<span v-if="bindedObject.completed">✅ Mask completed</span>
|
<span v-if="boundObject.completed">✅ Mask completed</span>
|
||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
<!-- tabs:end -->
|
<!-- tabs:end -->
|
||||||
@@ -245,7 +245,7 @@ export default {
|
|||||||
You can set options and bind to an object at the same time:
|
You can set options and bind to an object at the same time:
|
||||||
|
|
||||||
``` html
|
``` html
|
||||||
<input v-maska:[options]="bindedObject">
|
<input v-maska:[options]="boundObject">
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Global registration of directive
|
#### Global registration of directive
|
||||||
|
|||||||
+4
-4
@@ -31,11 +31,11 @@ export const vMaska: MaskaDirective = (el, binding) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (binding.value != null) {
|
if (binding.value != null) {
|
||||||
const binded = binding.value
|
const bound = binding.value
|
||||||
const onMaska = (detail: MaskaDetail): void => {
|
const onMaska = (detail: MaskaDetail): void => {
|
||||||
binded.masked = detail.masked
|
bound.masked = detail.masked
|
||||||
binded.unmasked = detail.unmasked
|
bound.unmasked = detail.unmasked
|
||||||
binded.completed = detail.completed
|
bound.completed = detail.completed
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.onMaska =
|
opts.onMaska =
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { MaskaDetail, vMaska } from '../../src'
|
import { MaskaDetail, vMaska } from '../../src'
|
||||||
|
|
||||||
const binded = reactive<Partial<MaskaDetail>>({})
|
const bound = reactive<Partial<MaskaDetail>>({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="binded" data-maska="#-#" value="123" />
|
<input v-maska="bound" data-maska="#-#" value="123" />
|
||||||
<div>{{ binded.masked }}</div>
|
<div>{{ bound.masked }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { MaskaDetail, vMaska } from '../../src'
|
import { MaskaDetail, vMaska } from '../../src'
|
||||||
|
|
||||||
const binded = reactive<Partial<MaskaDetail>>({})
|
const bound = reactive<Partial<MaskaDetail>>({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="binded" data-maska="#-#" />
|
<input v-maska="bound" data-maska="#-#" />
|
||||||
<div>{{ binded.masked }}</div>
|
<div>{{ bound.masked }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { MaskaDetail, vMaska } from '../../src'
|
import { MaskaDetail, vMaska } from '../../src'
|
||||||
|
|
||||||
const binded = reactive<Partial<MaskaDetail>>({})
|
const bound = reactive<Partial<MaskaDetail>>({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="binded" data-maska="#-#" />
|
<input v-maska="bound" data-maska="#-#" />
|
||||||
<div>{{ binded.unmasked }}</div>
|
<div>{{ bound.unmasked }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { MaskaDetail, vMaska } from '../../src'
|
|||||||
|
|
||||||
const emit = defineEmits(['mask1', 'mask2', 'mask3'])
|
const emit = defineEmits(['mask1', 'mask2', 'mask3'])
|
||||||
|
|
||||||
const binded1 = reactive({})
|
const bound1 = reactive({})
|
||||||
const binded2 = reactive({})
|
const bound2 = reactive({})
|
||||||
|
|
||||||
const options1 = {
|
const options1 = {
|
||||||
onMaska: (detail: MaskaDetail) => emit('mask1', detail)
|
onMaska: (detail: MaskaDetail) => emit('mask1', detail)
|
||||||
@@ -19,6 +19,6 @@ const options2 = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input id="input1" v-maska:[options1]="binded1" data-maska="#-#" />
|
<input id="input1" v-maska:[options1]="bound1" data-maska="#-#" />
|
||||||
<input id="input2" v-maska:[options2]="binded2" data-maska="#-#" />
|
<input id="input2" v-maska:[options2]="bound2" data-maska="#-#" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { MaskaDetail, vMaska } from '../../src'
|
import { MaskaDetail, vMaska } from '../../src'
|
||||||
|
|
||||||
const binded = reactive<Partial<MaskaDetail>>({})
|
const bound = reactive<Partial<MaskaDetail>>({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="binded" data-maska="#-#-#" />
|
<input v-maska="bound" data-maska="#-#-#" />
|
||||||
<div v-if="binded.completed">Completed</div>
|
<div v-if="bound.completed">Completed</div>
|
||||||
<div v-else>Uncompleted</div>
|
<div v-else>Uncompleted</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { vMaska, MaskaDetail, MaskInputOptions } from '../../src'
|
import { vMaska, MaskaDetail, MaskInputOptions } from '../../src'
|
||||||
|
|
||||||
const binded = reactive<Partial<MaskaDetail>>({})
|
const bound = reactive<Partial<MaskaDetail>>({})
|
||||||
const config = reactive<MaskInputOptions>({
|
const config = reactive<MaskInputOptions>({
|
||||||
mask: 'A A',
|
mask: 'A A',
|
||||||
tokens: {
|
tokens: {
|
||||||
@@ -16,6 +16,6 @@ const config = reactive<MaskInputOptions>({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska:[config]="binded" />
|
<input v-maska:[config]="bound" />
|
||||||
<div>{{ binded.masked }}</div>
|
<div>{{ bound.masked }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { vMaska } from '../../src'
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
binded: {
|
bound: {
|
||||||
masked: ''
|
masked: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input v-maska="binded" data-maska="#-#" />
|
<input v-maska="bound" data-maska="#-#" />
|
||||||
<div>{{ binded.masked }}</div>
|
<div>{{ bound.masked }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user