问:vue如何使用动态组件?component用过没有?
七娃博客
184人阅读
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 } }
主题开源不易,支持一下作者吧!
使用支付宝打赏
使用微信打赏
评论 | 0 条评论
登录之后才可留言,前往登录