kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
20 lines (19 loc) • 466 B
JavaScript
export default {
inserted(el, { value }, vnode) {
if (value) {
const parentNode = el.parentNode;
if (!parentNode) return false;
const target = value.$el
? value.$el
: (value === true ? document.body : value) || document.body;
target.appendChild(el);
el.__data = { parentNode };
}
},
unbind(el, { value }) {
if (value) {
el.__data.parentNode.appendChild(el);
el.__data = null;
}
},
};