1
2
3
4
5
6
7
8
9
10
11
12
<van-grid :column-num="2" class="content" :border="false" >
  <van-grid-item class="box" v-for="(item2,index2) in list" :key="index2" >
    <div class="inner-box" v-if="!item2.isBack" @touchstart="touchstartevent(item2,index2)" @touchmove="touchmoveevent(item2,index2)" @touchend="touchendevent(item2,index2)" >
      <span>正面</span>
    </div>
    <div class="inner-box-back" @click.stop="deleteModel(item2,index2)" v-else>    
 
      <span>删除</span>
 
    </div>
   </van-grid-item>
</van-grid>  
复制代码
// 模板长按删除功能
touchstartevent(item,index){
  this.closeDeleteevent()//清除删除图标事件
  var self = this;
  this.timeoutEvent = 0;
  this.timeoutEvent = setTimeout(() => {
    self.enterLongevent(item,index);//长按执行的操作
  },1000)
},
enterLongevent(item,index){
  item.isBack = true;
  console.log("长按了呀")
},
touchmoveevent(item,index){
  console.log("移动了")
  clearTimeout(this.timeoutEvent)
  this.timeoutEvent = 0;
},
touchendevent(item,index){
  console.log("离开屏幕")
  clearTimeout(this.timeoutEvent)
  this.timeoutEvent = 0;
},
复制代码

 

复制代码
.inner-box{
  width: 100%;
  border-radius: 10px;
  border: 1px solid #f2f2f2;
  -webkit-touch-callout: none!important;
  -webkit-user-select: none!important;
  -moz-user-select:none;
  -ms-uese-select:none;
  user-select: none;
  animation: mymoveone 0.5s ease-in-out;
}
@keyframes mymoveone{
  from{
  opacity: 0;
    transform: rotateY(90deg);
  }
to{
  opacity: 1;
    transform: rotateY(0);
  }
}
.inner-box-back{
  width: 100%;
  height: 99px;
  animation: mymove 0.5s ease-in-out;
  border-radius: 10px;
  border: 1px solid #f2f2f2;
  background: fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: #333333;
}
@keyframes mymove{
  from{
    opacity: 0;
    transform: rotateY(-90deg);
  }
  to{
    opacity: 1;
    transform: rotateY(0);
  }
}
复制代码

 效果:

暂时无法显示

posted on   菜菜小江升级打怪之路  阅读(241)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示