vue-model-on
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -1,1 +0,1 @@ | ||
Vue.directive("model-on",{bind:function(e,n,i){e.addEventListener(n.arg,function(){i.context[n.expression]=e.value})}}); | ||
Vue.directive("model-on",{bind:function(e,n,t){e.value=t.context[n.expression],e.addEventListener(n.arg,function(){t.context[n.expression]=e.value})},update:function(e,n,t){e.value=t.context[n.expression]}}); |
{ | ||
"name": "vue-model-on", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Allows you to set the event type when binding model data in Vue.js", | ||
@@ -5,0 +5,0 @@ "main": "src/vue-model-on.js", |
# vue-model-on for Vue 2.x | ||
By default Vue's `v-model` uses the `input` event to update the underlying model data, `vue-model-on` is a simple directive that allows you to set the event type for updating model data in Vue.js. Simply use `v-model-on:event="myVar"` instead of `v-model="myVar"` | ||
By default Vue's `v-model` uses the `input` event to update the underlying model data, `vue-model-on` is a simple directive that allows you to set the event type for updating model data in Vue.js. Simply use `v-model-on:event="myVar"` instead of `v-model="myVar"` to set up your two way binding. | ||
@@ -9,3 +9,3 @@ ## Install | ||
`npm install vue-model-on --save-dev` | ||
`npm install vue-model-on` | ||
@@ -22,3 +22,3 @@ Then simply use `require`: | ||
`<script src="https://unpkg.com/vue-model-on@1.0.0" ></script>` | ||
`<script src="https://unpkg.com/vue-model-on@latest/dist/vue-model-on.js" ></script>` | ||
@@ -45,3 +45,3 @@ ## Example | ||
[Check it out on JSFiddle](https://jsfiddle.net/b20jk7po/) | ||
[Check it out on JSFiddle](https://jsfiddle.net/craig_h_411/6Lmb1h9s/) | ||
@@ -48,0 +48,0 @@ |
Vue.directive('model-on', { | ||
bind: function(el, binding, vnode) { | ||
el.addEventListener(binding.arg, function() { | ||
vnode.context[binding.expression] = el.value; | ||
}); | ||
} | ||
}); | ||
bind: function(el, binding, vnode) { | ||
el.value = vnode.context[binding.expression]; | ||
el.addEventListener(binding.arg, function() { | ||
vnode.context[binding.expression] = el.value; | ||
}); | ||
}, | ||
update: function(el, binding, vnode) { | ||
el.value = vnode.context[binding.expression]; | ||
} | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2958
29