Skip to content

Commit

Permalink
Showing 9 changed files with 30 additions and 16 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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:
4 changes: 2 additions & 2 deletions dist/es6/maska.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/es6/maska.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/es6/maska.umd.js
4 changes: 2 additions & 2 deletions dist/maska.esm.js
4 changes: 2 additions & 2 deletions dist/maska.js
4 changes: 2 additions & 2 deletions dist/maska.umd.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maska",
"version": "1.3.0",
"version": "1.3.1",
"description": "Simple zero-dependency input mask for Vue.js and vanilla JS",
"keywords": [
"mask",
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ import tokens from './tokens'
function install (Vue) {
Vue.directive('maska', directive)
}
// Install by default if included from script tag
if (typeof window !== 'undefined' && window.Vue) {
// Install by default if included from script tag (only Vue 2)
if (typeof window !== 'undefined' && window.Vue && window.Vue.use) {
window.Vue.use(install)
}

@@ -17,6 +17,7 @@ function create (el, options) {

export default install
export {
install,
create,
mask,
directive as maska,

0 comments on commit ea6f31b

Please sign in to comment.