mirror of https://github.com/ElemeFE/element
Popover: fix error when reference comes before popover (#10273)
parent
0fa60fe264
commit
1362bae57d
|
@ -1,7 +1,16 @@
|
|||
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;
|
||||
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) {
|
||||
getReference(el, binding, vnode);
|
||||
},
|
||||
inserted(el, binding, vnode) {
|
||||
getReference(el, binding, vnode);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue