我是靠谱客的博主 还单身烤鸡,这篇文章主要介绍uniapp如何实现长按删除,现在分享给大家,希望可以做个参考。

本教程操作环境:windows7系统、uni-app2.5.1版本、thinkpad t480电脑。

推荐(免费):uni-app开发教程

uniapp实现长按删除的方法:

1、view代码

复制代码
1
2
3
<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代码

复制代码
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
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); },
登录后复制

以上就是uniapp如何实现长按删除的详细内容,更多请关注靠谱客其它相关文章!

最后

以上就是还单身烤鸡最近收集整理的关于uniapp如何实现长按删除的全部内容,更多相关uniapp如何实现长按删除内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(99)

评论列表共有 0 条评论

立即
投稿
返回
顶部