Vue 同一组件重复用,数据被覆盖的问题

有时候使用Vue组件需要在页面中多次使用,比如vant的button组件,有时需要显示两个

 

<van-button type="default">默认按钮</van-button>
<van-button type="primary">主要按钮</van-button>

 

但这样的话,第一个按钮会无法显示,使用如下方式就可以解决~

<component is="van-button" type="default">默认按钮</component >
<component is="van-button" type="primary">主要按钮</component >

 

posted @ 2020-05-04 20:16  qiuxd  阅读(8840)  评论(2编辑  收藏  举报