<template> <view v-for="(item, index) in dataList" :key="index"> <view class="memberBox" @click="handleTouch(item, index)">{{index}}</view> </view> </template> <script> export default { data(){ dataList:[] } methods: { handleTouch(item,index){ let arr = [1,2,3,4,5,6,7,8,9]; let arr2 = []; let indexs = arr.findIndex((items) => items == 1); if(indexs==-1){ arr2.push(item,id) }else{ arr2.splice(arr2.indexOf(item.id),1) } } } } </script>