profile
viewpoint

Ask questionsVNode.componentInstance is undefined when rendered by a functional component

Version

2.5.17-beta.0 2.5.16

Reproduction link

https://codepen.io/anon/pen/rKwWXq?editors=1010

Steps to reproduce

Open the console

What is expected?

An instance of MyComponent should be logged

What is actually happening?

undefined is logged


This worked in 2.5.15 It also works if you change RootComponent to be non-functional:

const content = h(MyComponent, {}, this.slots.default)

I'm guessing this was caused by 62a922e8, cloneVNode doesn't include that property.

<!-- generated by vue-issues. DO NOT REMOVE -->

vuejs/vue

Answer questions sc0Vu

@KaelWD Did you solve this issue? The componentInstance is also undefined when I use named slot like:

A component template

<template v-slot:body>
  <test>Hello world</test>
</template>

B component template

<div>
  <slot name="body"></slot>
</div>

B component script

export default {
  mounted () {
    console.log(this.$slots.body)
  }
}
useful!

Related questions

[Vue warn]: Error in nextTick: "RangeError: Maximum call stack size exceeded" while navigating to another route hot 1
关于keep-alive缓存页面问题请教 hot 1
Can not clear slot content with vue@2.5.3 hot 1
TypeError: Cannot read property 'toLowerCase' of undefined at emptyNodeAt hot 1
Korean input trigger keydown event twice hot 1
Proposal: Template inheritance using the slots mechanism hot 1
Memory leak when using "transition" and "keep-alive" hot 1
Error in v-on handler: "RangeError: Maximum call stack size exceeded" hot 1
如何通过v-bind:style动态生成背景图? hot 1
如何通过v-bind:style动态生成背景图? hot 1
IE11, console print: [Vue warn]: Error in nextTick: "Error: Invalid argument." But work well with chrome hot 1
v-bind:style 'background-image' error: url is not a function hot 1
force re-computation of a computed property hot 1
v-model on mobile not updating until a space is pressed hot 1
There is no a attribute like react's $$typeof to prevent XSS injection in the vnode of Vue. hot 1
Github User Rank List