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.
25 lines
610 B
25 lines
610 B
5 years ago
|
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);
|
||
|
},
|
||
|
};
|