<div class="payment_box"  v-for="(item,index) in bannerList8" :key="item.id" v-show="pay_isclose.indexOf(index) == -1">
      <div class="pay_box" >
        <div class="close" @click="close(index)">×</div>
        <img :src="item.ad_code" alt="">
        <a class="pay_link" @click="pay_link(index,item.ad_link)"></a>
        <span><i @click="pay_btn"><img src="../../../static/images/Path 81.png" alt="" style="width: 12px;height: 12px;"  v-show="remind_img"></i>不再提醒</span>
      </div>
    </div>

v-show="pay_isclose.indexOf(index) == -1" 通过此函数判断检测是否存在这个index

close(num_index) { 
		this.pay_isclose.push(num_index);
		 localStorage.setItem('pay_isclose',JSON.stringify(this.pay_isclose));
 }

将点击触发哪一个然后把值赋进去,将数组转成字符串,方便把各个值带到数组中

pay_close() {
        var pay_isclose = sessionStorage.getItem('pay_isclose');
        if(pay_isclose)  this.pay_isclose = JSON.parse(pay_isclose);
 }

在将字符串转成数组的形式,存到cook

Logo

前往低代码交流专区

更多推荐