码迷,mamicode.com
首页 > 移动开发 > 详细

uni-app中长按删除

时间:2020-06-29 18:28:39      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:oop   modal   var   else   int   art   dal   event   list   

1、view代码

<view class="imgShow" v-for="(item,index) in list" :key="index">
  <image :src="item.image_path" @touchstart.prevent="touchstart(index)" @touchend.prevent="touchend"></image>
</view>

2、script代码

touchstart(index) {
  let that = this;
  clearInterval(this.Loop); //再次清空定时器,防止重复注册定时器
    this.Loop = setTimeout(function() {
      uni.showModal({
        title: ‘删除‘,
        content: ‘请问要删除本条消息吗?‘,
        success:async function(res) {
          if (res.confirm) {
            var id = that.list[index].id
            let data = await that.$http.post(‘api/shop/shop_qualification_image/delete‘,{
            ‘id‘:id,
          }).then(function(data){

            console.log(‘用户点击确定‘)

          }).catch(function(data){});

        } else if (res.cancel) {
          console.log(‘用户点击取消‘)
        }
      }
    });
  }.bind(this), 1000);
},
touchend() {
  clearInterval(this.Loop);
},

 

uni-app中长按删除

标签:oop   modal   var   else   int   art   dal   event   list   

原文地址:https://www.cnblogs.com/menxiaojin/p/13209492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!