2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-17 19:21:21 +03:00

Better support for Vue 3.x

This commit is contained in:
Alexander Shabunevich
2020-10-15 13:13:33 +03:00
parent 7cc8274b85
commit ea6f31babd
9 changed files with 30 additions and 16 deletions
+14 -1
View File
@@ -18,7 +18,7 @@ To load latest version from CDN you can use:
<script src="https://cdn.jsdelivr.net/npm/maska@latest/dist/maska.js"></script>
```
## Usage with Vue.js
## Usage with Vue 2.x
If you load Vue.js via `<script>` then just add `v-maska` directive to your input:
@@ -59,6 +59,19 @@ export default {
With Vue you could use computed property as mask value. In this case mask will be reactive.
## Usage with Vue 3.x
With Vue 3.x you need to explicitly add Maska `plugin` or `directive` to your app:
``` javascript
const app = Vue.createApp({...})
// use as plugin
app.use(Maska.install);
// or as directive
// app.directive('maska', Maska.maska);
app.mount('#app');
```
## Usage with vanilla JS
Just load script `maska.js` and init it, passing element(s) or `document.querySelector` expression: