@@ -112,18 +112,22 @@ To get masked value you can use standard `v-model` directive on the input. But i
112
112
import { ref } from "vue"
113
113
import { vMaska } from "maska/vue"
114
114
115
- const maskedvalue = ref('')
116
- const unmaskedvalue = ref('')
115
+ const maskedValue = ref('')
116
+ const unmaskedValue = ref('')
117
+
118
+ defineExpose({ unmaskedValue }) // make sure you expose the bound variable
117
119
</script>
118
120
119
121
<template>
120
- <input v-maska:unmaskedvalue .unmasked data-maska="#-#" v-model="maskedvalue ">
122
+ <input v-maska:unmaskedValue .unmasked data-maska="#-#" v-model="maskedValue ">
121
123
122
- Masked value: {{ maskedvalue }}
123
- Unmasked value: {{ unmaskedvalue }}
124
+ Masked value: {{ maskedValue }}
125
+ Unmasked value: {{ unmaskedValue }}
124
126
</template>
125
127
```
126
128
129
+ !> Make sure you expose the bound variable using ` defineExpose ` macro.
130
+
127
131
### ** Options API**
128
132
129
133
``` vue
@@ -133,23 +137,21 @@ To get masked value you can use standard `v-model` directive on the input. But i
133
137
export default {
134
138
directives: { maska: vMaska },
135
139
data: () => ({
136
- maskedvalue : "",
137
- unmaskedvalue : ""
140
+ maskedValue : "",
141
+ unmaskedValue : ""
138
142
})
139
143
}
140
144
</script>
141
145
142
146
<template>
143
- <input v-maska:unmaskedvalue .unmasked data-maska="#-#" v-model="maskedvalue ">
147
+ <input v-maska:unmaskedValue .unmasked data-maska="#-#" v-model="maskedValue ">
144
148
145
- Masked value: {{ maskedvalue }}
146
- Unmasked value: {{ unmaskedvalue }}
149
+ Masked value: {{ maskedValue }}
150
+ Unmasked value: {{ unmaskedValue }}
147
151
</template>
148
152
```
149
153
<!-- tabs:end -->
150
154
151
- !> For correct work as directive argument, name of the bounded variable should be in ** lower case** . So instead of ` unmaskedValue ` use ` unmaskedvalue ` or ` unmasked_value ` .
152
-
153
155
154
156
## Usage with Nuxt
155
157
0 commit comments