question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

a bug of"undefined" when using slot

See original GitHub issue

Vue.js version

2.1.7

Reproduction Link

https://jsfiddle.net/jkin8010/j7s5prkv/5/

Steps to reproduce

Icon.vue

<template>
    <i :class="className"></i>
</template>
<script>
export default {
    props: {
        type: String
    },
    computed: {
        className () {
            return `c-icon c-icon-${this.type}`
        }
    }
}
</script>

Hello.vue

<template>
  <div class="hello">
    <icon type="clear"></icon>
    <slot name="right"><slot>
  </div>
</template>
<script>
import Icon from './icon.vue';
export default {
  components: {
    Icon
  }
}
</script>

App.vue

<template>
  <div id="app">
    <hello>
      test2
    </hello>
  </div>
</template>

<script>
import Hello from './Hello'
export default {
  components: {
    Hello
  }
}
</script>

What is Expected?

What is actually happening?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
posvacommented, Oct 13, 2017

see #6793

0reactions
fritxcommented, Oct 13, 2017

With vue@2.4.4/vue-template-compiler@2.4.4 and before, it was fine:

but upgraded them both to the latest: 2.5.0, the weird “undefined” show up again:

Is it bug of element-ui or vue?

Related: https://github.com/vuejs/vue/issues/4993, https://github.com/fritx/vue-at/issues/3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue slot is not working in rare and unpredictable cases ...
I noticed you are working with objects and turning them into arrays. Objects properties can be problematic to work with, because unlike arrays ......
Read more >
611653 - Assertion failure: obj->containsSlot(slot) - Bugzilla@Mozilla
It seems to me that's probably a bug in the extension's use of JSAPI, ... 0x11d325f60 slots: 0 (reserved) = undefined 1 (reserved)...
Read more >
Empty slots Lesson - JavaScript Arrays - Execute Program
When we use new Array , the array appears to be full of undefined . · > new Array(1)[0]; · However, the slot...
Read more >
Docs • Svelte
Components can be placed in a named slot using the syntax <Component slot="name" /> . In order to place content in a slot...
Read more >
error in nexttick: "typeerror: cannot read properties ... - You.com
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found