vue通过内置组件通过component组件用is动态绑定组件名实现动态组件,组件在运行时,根据is的值不一样,切换不同的组件显示。

<button @click='comp = ComponentA'>Component A</button>
<button @click='comp = ComponentB'>Component B</button>
<component :is='comp' />

data () {
  return {
    comp: ComponentA
  }
}