Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 7x 7x | import single from '../../utils/event/single'; const handler = function (e, data) { Object.values(data).forEach(({ el, binding }) => { if (el.contains(e.target)) return false; if (binding.expression) binding.value(e); }); }; export const clickOutside = { bind(el, binding) { el['v-click-outside-off'] = single.on('v-click-outside' + new Date(), { el, binding, }, document, 'click', handler); }, unbind(el) { if (el['v-click-outside-off']) { el['v-click-outside-off'](); delete el['v-click-outside-off']; } }, }; |