当前位置:网站首页>Implement a long-click list pop-up box on apiccloud
Implement a long-click list pop-up box on apiccloud
2022-06-30 14:28:00 【Bamboo shrimp】
1、what:
scene : use apicloud do APP It is required to press an item in the list for a long time to operate on the item
2、 How to do how:
- apicloud There is a long press event in the file of
api.addEventListener({
name:'longpress'
}, function(ret, err){
alert(' Long press the page ');
});
- vue There was a @touchstar event , Trigger when the finger just touches the element
<li class="comment-item" v-for="(item, index) in list" :key="item.id" @touchstart="getTouchStart(index, item.id)"> Your custom list content </li>
- combination 1 、2 At two o 'clock : When your finger just touches a list subitem , use touchstart Events to trigger getTouchStart function , This function monitors whether to long press longpress, If a long press is detected , Just do the business logic operation
//@touchstart Method called by event :
getTouchStart(index, _id) {
api.addEventListener({
name: 'longpress'
}, function (ret, err) {
// Long press the page , Pop up the prompt box
api.actionSheet({
cancelTitle: ' Cancel ',
buttons: [' Delete the comment ']
}, function (ret, err) {
if (ret.buttonIndex === 1) {
// Pop up the confirmation prompt box
api.confirm({
title: ' confirm deletion ',
msg: ' Are you sure you want to delete the current ' + lou + ' Floor comments ?',
buttons: [' determine ', ' Cancel ']
}, function (ret, err) {
if (ret.buttonIndex == 1) {
// Do your business operation
}
});
}
});
});
}
3、 Why not use the time listener to write long press events ?why
I turned it over , About online vue The long press event of involves a timer , also touchmove,touchend, It's too much work to do , More expensive , And the original development has been lost api The advantages of .
边栏推荐
- 数据恢复软件EasyRecovery15下载
- V3_ Chrome extended Chinese translation document V3 directory
- org. json. The jsonobject object is converted to JSON, and JSON adds new elements. The value is obtained according to the JSON key. And list object format string to jsonarray
- Talk about Vue's two terminal diff algorithm, analysis of the rendering principle of the mobile terminal, and whether the database primary key must be self incremented? What scenarios do not suggest s
- Impersonate server and client using message queuing
- [buuctf] [actf2020 freshman competition]include
- Je suis à Foshan, où puis - je ouvrir un compte? L'ouverture d'un compte par téléphone mobile est - elle sécurisée?
- Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
- Complete TCP forwarding server (kernel linked list + mutex)
- go time. after
猜你喜欢
go channel && select
Realize a simple LAN communication (similar to feiqiu)
MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video
"As a service", the inevitable choice of enterprise digital transformation
Ctfshow getting started with the web (ThinkPHP topic)
Apache Doris comparison optimization Encyclopedia
Introduction to reverse commissioning - VA and RVA conversion in PE 04/07
Deep understanding Net (2) kernel mode 4 Summary of kernel pattern constructs
Introduction to the construction and development of composer private warehouse
Using docker to manage MySQL services under Windows
随机推荐
PHP 2D array change key name
What network security problems are exposed when a large-scale QQ number theft event occurs?
Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
PHP multidimensional array sorting
V3 01_ Welcome
notepad正则删除关键词所在行
Ctfshow getting started with the web (ThinkPHP topic)
【Kubernetes系列】K8s设置MySQL8大小写不敏感
从控制层返回到js的json数据带“\”转译符,怎么去掉
深入理解.Net中的线程同步之构造模式(二)内核模式4.内核模式构造物的总结
PHP excel export function encapsulation (based on phpexcel class)
Initial attack and defense world Misc
Logiciel de récupération de données easyrecovery15 téléchargement
编程实战赛来啦!B站周边、高级会员等好礼送你啦!
Introduction to the construction and development of composer private warehouse
Flat shading with unity
Project management - common English vocabulary I
Introduction to the renewal of substrate source code: the pallet alliance is incorporated into the main line,
Optimization of unit test efficiency: why test programs? What are the benefits of testing?
Three uses of golang underscores