Commit 1362bae5 authored by 杨奕's avatar 杨奕 Committed by GitHub

Popover: fix error when reference comes before popover (#10273)

parent 0fa60fe2
const getReference = (el, binding, vnode) => {
const _ref = binding.expression ? binding.value : binding.arg;
const popper = vnode.context.$refs[_ref];
if (popper) {
popper.$refs.reference = el;
}
};
export default {
bind(el, binding, vnode) {
// vue中 v-popover:argument 和 v-popover="variate|| expression"得到的binding数据是不同的。后者可以指向动态popver组件,可以极大的增强popover指令的灵活程度。
const _ref = binding.expression ? binding.value : binding.arg;
vnode.context.$refs[_ref].$refs.reference = el;
getReference(el, binding, vnode);
},
inserted(el, binding, vnode) {
getReference(el, binding, vnode);
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment