Skip to content

Built-In Component component's prop IS can not receive async component factory function #6272

@changchengqin

Description

@changchengqin

Version

2.4.2

Steps to reproduce

1.Use Built-in Component : component

<script src="https://unpkg.com/vue"></script>

<div id="app">
  <p>{{ message }}</p>
  <component></component>
</div>

2.Declare a method called getAsyncComponent in Vue methods block that return an asynchronous component factory function

new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue.js!'
  },
  methods:{
    getAsyncComponent() {
      return () => Promise.resolve({
        template: `<p>Hello</p>`
      })
    }
  }
})

3.Call getAsyncComponent for component's is attribute

<script src="https://unpkg.com/vue"></script>

<div id="app">
  <p>{{ message }}</p>
  <component :is="getAsyncComponent()"></component>
</div>

What is expected?

doesn't render async component

What is actually happening?

The getAsyncComponet method will enter the dead loop call

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions