While I have successfully created an npm package by exporting a single vue directive in the src/index.js file, I am now faced with the challenge of creating a package that allows for the use of multiple vue directives. Unfortunately, I have been unable to export two vue directives in the same index.js file.
export default Vue.directive('directive1', {
inserted: function (el, binding, vnode) {
el.addEventListener('mouseup', (e) => mouseup(e, el, _data))
el.addEventListener('mousedown', (e) => mousedown(e, el, _data))
el.addEventListener('mousemove', (e) => mousemove(e, el, _data))
setDraggerOffset(el, _data)
}
})
export default Vue.directive('directive2', {
inserted: function (el, binding, vnode) {
el.addEventListener('mouseup', (e) => mouseup(e, el, _data))
el.addEventListener('mousedown', (e) => mousedown(e, el, _data))
el.addEventListener('mousemove', (e) => mousemove(e, el, _data))
setDraggerOffset(el, _data)
}
})