In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to delete pictures by long press WeChat Mini Programs". The content is simple and clear. I hope it can help you solve your doubts. Next, let the editor lead you to study and learn the article "WeChat Mini Programs how to delete pictures by long press".
Mini Program realizes the solution of deleting specified pictures by long press.
Long press event uses bindlongpress (does not conflict with click event bindtap)
Add the index index in wxml, and then use currentTarget.dataset.index to get the current element subscript in js
Delete splice (index,1) through the splice method, deleting a current element
Concrete realization
Add bindlongpress= "deleteImage" data-index= "{{index}}" to wxml to bind events and add index index
DeleteImage: function (e) {var that = this; var images = that.data.images; var index = e.currentTarget.dataset.indexapace / get the current long subscript wx.showModal ({title: 'prompt', content: 'are you sure you want to delete this picture?' , success: function (res) {if (res.confirm) {console.log ('Click OK'); images.splice (index, 1);} else if (res.cancel) {console.log ('Click cancel'); return false;} that.setData ({images}) })}
Delete part of the code
Notice the difference between currentTarget and target
CurrentTarget: the current element of the bound event and its child elements will trigger
Target: bound event child elements will not be triggered by events
The above is all the contents of the article "how to delete pictures by long press WeChat Mini Programs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.