You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/_util/portalDirective.js

25 lines
610 B

export function antPortal(Vue) {
return Vue.directive('ant-portal', {
inserted(el, binding) {
const { value } = binding;
const parentNode = typeof value === 'function' ? value(el) : value;
if (parentNode !== el.parentNode) {
parentNode.appendChild(el);
}
},
componentUpdated(el, binding) {
const { value } = binding;
const parentNode = typeof value === 'function' ? value(el) : value;
if (parentNode !== el.parentNode) {
parentNode.appendChild(el);
}
},
});
}
export default {
install: Vue => {
antPortal(Vue);
},
};