Last active
May 3, 2017 11:43
-
-
Save logaretm/13f9f0fa1df5b1ecf1e5 to your computer and use it in GitHub Desktop.
VueJS Utility Directives: some useful VueJS directives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cleans GET query parameters by disabling empty inputs using jquery. | |
Vue.directive('clean', { | |
onSubmit() { | |
$(':input', this).each(function() { | |
this.disabled = !($(this).val()); | |
}); | |
}, | |
bind() { | |
$(this.el).submit(this.onSubmit); | |
}, | |
unbind() { | |
$(this.el).unbind('submit', this.onSubmit) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't use that. Avoid using jQuery as much as you can. That's my advice.
Plus, those doesn't seem useful to me as it can be easily done (and in a lot of better ways) by VueJs directly into the html.
Please don't rush code, it'll do nothing good for you nor the others (especially the others who don't know).
I hope you won't be mad at this.