complete94

没有写样式,只是写个功能

<template>
<div class="headers">
  <div class="form">
    <input type="text" v-model="text"/>
    <button v-on:click="tabs">提交评论</button>
  </div>

 <div class="text">
   <div v-for="(name,index) in arr" v-on:click="dele(index)">{{name.text}}</div>   /* dele的index是下标,用来删除我们点击的信息 */
 </div>
</div>
</template>
<script>
export default {
data(){
  return {
   text:"",
   arr:[]
  }
},
 methods: {
    tabs:function(){
       this.arr.push({text:this.text});
       this.text="";
       console.log(this.arr)
    },
    dele:function(index){
      this.arr.splice(index,1)
     }
 }
};
</script>

  

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-24
  • 2022-01-08
  • 2022-12-23
  • 2021-09-26
  • 2021-08-04
  • 2021-12-29
  • 2021-11-30
猜你喜欢
  • 2021-08-15
  • 2021-11-30
  • 2021-12-19
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案