mirror of https://github.com/ElemeFE/element
parent
d528498cd0
commit
1eaec019e3
|
@ -1,5 +1,6 @@
|
||||||
import Popper from 'element-ui/src/utils/vue-popper';
|
import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
import debounce from 'throttle-debounce/debounce';
|
import debounce from 'throttle-debounce/debounce';
|
||||||
|
import { getFirstComponentChild } from 'element-ui/src/utils/vdom';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -65,9 +66,10 @@ export default {
|
||||||
</div>
|
</div>
|
||||||
</transition>);
|
</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 data = vnode.data = vnode.data || {};
|
||||||
const on = vnode.data.on = vnode.data.on || {};
|
const on = vnode.data.on = vnode.data.on || {};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
export function isVNode(node) {
|
export function isVNode(node) {
|
||||||
if (!node || typeof node !== 'object') return false;
|
return typeof node === 'object' && Vue.util.hasOwn(node, 'componentOptions');
|
||||||
return Vue.util.hasOwn(node, 'tag') && Vue.util.hasOwn(node, 'componentOptions');
|
};
|
||||||
|
|
||||||
|
export function getFirstComponentChild(children) {
|
||||||
|
return children && children.filter(c => c && c.tag)[0];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue