vue页面点击按钮增加和删除标签


1、在data()里定义一个空数组:

conditions:[],

2、给数组一个容器,并且遍历数组

<div v-for="item in conditions">
<div>数组中的数据</div>
...
</div>

3、给按钮绑定单击事件

<el-button type="text" @click="newconditions()"><i class="el-icon-circle-plus-outline"></i>新增条件</el-button>

4、在单击事件中利用push方法向数组增加数据(增加标签)

newconditions(){
this.conditions.push(1);
},

5、删除数据

remove(){
this.conditions.pop(1);
}

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM