Subscribe on changes!

Dynamic component with pascalcase not working correctly

avatar
Mar 29th 2021

Version

3.0.9

Reproduction link

https://codesandbox.io/s/summer-sun-dymh9?file=/src/App.vue

Steps to reproduce

<template>
  <button @click="hello = !hello">Toggle</button>
  <Component :is="component" /> // not work. If it change to <component />, it works
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";
import ByeWorld from "./components/ByeWorld.vue";
export default {
  name: "App",
  components: {
    HelloWorld,
    ByeWorld,
  },
  data() {
    return {
      hello: true,
    };
  },
  computed: {
    component() {
      return this.hello ? "HelloWorld" : "ByeWorld";
    },
  },
};
</script>

What is expected?

Component appear.

What is actually happening?

no error in console. and show nothing

avatar
Mar 30th 2021

interesting 🤔

at the following comment, only lowercase is allowed. https://github.com/vuejs/vue-next/issues/1167#issuecomment-626968071

But, PR https://github.com/vuejs/vue-next/pull/3508 make <Component> allowed.. 🤔

avatar
Mar 30th 2021

That should be a misunderstanding, because Vue2 allows a capitalized version, so we should keep that behavior.

avatar
Mar 30th 2021

And sorry to @danyadev for that

avatar
Mar 30th 2021

So... does it means that this issue is not an issue?

Vue3 DO NOT allow Pascal Case, <Component>?

avatar
Mar 30th 2021

That should be a misunderstanding, because Vue2 allows a capitalized version, so we should keep that behavior.

Ah, I understood, Vue3 allow <Component> case as well.

avatar
Mar 30th 2021

Yeah, I closed #1167 without checking Vue 2 behavior, which was a mistake.

Since uppercase <Component :is> does work in Vue 2, we are keeping it consistent in Vue 3.