Vue.directive( id, [definition] )
Arguments:
{string} id
{Function | Object} [definition]
Usage:
Register or retrieve a global directive.
// register
Vue.directive('my-directive', {
bind: function () {},
inserted: function () {},
update: function () {},
componentUpdated: function () {},
unbind: function () {}
})
// register (function directive)
Vue.directive('my-directive', function () {
// this will be called as `bind` and `update`
})
// getter, return the directive definition if registered
var myDirective = Vue.directive('my-directive')
See also: Custom Directives