Click on the current element in the vue v-for loop to show and then click hide

<li v-for="(list,index) in getTableData(currentPage)" :key="index">
              <div class="popup-msg-div">
                <div class="msg-div-add">{{list.detail_address}}</div>
                <div>{{list.serial_number}}</div>
                <div>{{list.createtime}}</div>
                <div class="msg-div-add">{{list.warn_desc}}</div>
                <div class="popup-msg-more" @click="msgShow(index)"></div>
              </div>
              <div class="msg-box" v-show="activeIndex===index">
                <div class="msg-box-tit popup-msg-tit ">
                  
                  <div class="popup-box-close" @click="msgClose(index)"><b></b></div>
                </div>
                <div class="msg-div">
                  <div></div>
                  <div></div>
                  <div></div>
                </div>
                <div class="msg-div" v-for="item in list.detailList">
                  <div>{{item.warn_desc}}</div>
                  <div>{{item.createtime}}</div>
                  <div>{{item.ctrl_name}}:{{item.ctrl_phone}}</div>
                </div>
              </div>
            </li>
 data() {
    return {
      activeIndex: -1 
    };
  },
//
    msgShow (index) {
      this.activeIndex = index;
    },
    //
    msgClose(index) {
      this.activeIndex = !index;
    },

I now have two click event controls. I want to use msgShow as an event control.

May.27,2021

try to download different parameters?

<div class="popup-msg-more" @click="msgShow(index)"></div>
msgShow (index) {
      this.activeIndex = this.activeIndex == index ? -1 : index;
},

another idea:

iterate through first, adding an isShowDetail: false to each item in the getTableData array
< div class= "popup-msg-more" @ click= "msgShow (list,index)" > for details < / div >

<div class="msg-box" v-show="list.isShowDetail">

methods:{
    msgShow (list,index) {
        list.isShowDetail = !list.isShowDetail;
    },
}

ensures that the details of each piece of data are displayed independently from the closed status.
so that the button can also display different text through the status of list.isShowDetail

.
msgShow(index){
    this.activeIndex = this.activeIndex === index ? !index : index;
}
Menu