Tooltip: fix content slot, fixed #2999 (#3002)

This commit is contained in:
cinwell.li
2017-02-26 23:23:52 +08:00
committed by baiyaaaaa
parent d528498cd0
commit 1eaec019e3
2 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import Popper from 'element-ui/src/utils/vue-popper';
import debounce from 'throttle-debounce/debounce';
import { getFirstComponentChild } from 'element-ui/src/utils/vdom';
import Vue from 'vue';
export default {
@@ -65,9 +66,10 @@ export default {
</div>
</transition>);
if (!this.$slots.default) return this.$slots.default;
if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
const vnode = this.$slots.default[0];
const vnode = getFirstComponentChild(this.$slots.default);
if (!vnode) return vnode;
const data = vnode.data = vnode.data || {};
const on = vnode.data.on = vnode.data.on || {};