i-rubik
Version:
A Vue.js 2.0+ UI Components Framework
20 lines (16 loc) • 374 B
JavaScript
const directive = (el, binding, v) => {
el.dataset.modal = binding.arg
el.onclick = e => {
e.preventDefault()
v.context.$rubik.bridge.pub(`modal:open:${binding.arg}`)
}
}
export default {
bind: directive,
updated: directive,
componentUpdated: directive,
unbind (el) {
el.removeAttribute('onclick')
el.removeAttribute('data-modal')
}
}