Popover: v-popover directive supports expression (#9564)

This commit is contained in:
daipeng 2018-01-31 15:54:32 +08:00 committed by 杨奕
parent a64543b98c
commit 5ae30dd98f

View File

@ -1,5 +1,7 @@
export default {
bind(el, binding, vnode) {
vnode.context.$refs[binding.arg].$refs.reference = el;
// 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;
}
};