当前位置:网站首页>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 .
边栏推荐
- numpy 创建空数组 data = np.empty(shape=[1, 64,64,3])
- Small exercise of process and signal
- Solution cannot use a scalar value as an array
- Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
- 【Kubernetes系列】K8s设置MySQL8大小写不敏感
- Project management - common English vocabulary I
- C language & the difference between the address pointed to and the address pointed to by the pointer
- I want to ask how to open an account at China Merchants Securities? Is it safe to open a stock account through the link
- 【BUUCTF】 EasySql
- ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
猜你喜欢
![[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)](/img/70/8bf226964118efb324ca4d339df654.png)
[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)

What network security problems are exposed when a large-scale QQ number theft event occurs?

How to execute a query SQL

Fastcgi CGI shallow understanding

The programming competition is coming! B station surrounding, senior members and other good gifts to you!

Introduction to the construction and development of composer private warehouse

Optimization of unit test efficiency: why test programs? What are the benefits of testing?

用Unity实现Flat Shading

Google Earth engine (GEE) -- converts string to number and applies it to time search (ee.date.fromymd)

【科学文献计量】外文文献及中文文献关键词的挖掘与可视化
随机推荐
Flat shading with unity
Laravel8 custom log directory, rename
Laravel artist command error
Go language for loop multivariable use
The JSON data returned from the control layer to JS has a "\" translator. How to remove it
Go common lock mutex and rwmutex
[buuctf] [geek challenge 2019] secret file
Je suis à Foshan, où puis - je ouvrir un compte? L'ouverture d'un compte par téléphone mobile est - elle sécurisée?
表格储存中sql查询的时候,查询结果增加主键报错,查询结果超过10w行。需要对主键增加上多元索引吗?
QQ 居然被盗了?原因在这......
Three uses of golang underscores
@ResponseBody的作用
What network security problems are exposed when a large-scale QQ number theft event occurs?
PHP 2D array change key name
Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source!
Summary of use of laravel DCAT admin
【BUUCTF】 EasySql
The programming competition is coming! B station surrounding, senior members and other good gifts to you!
MV3 04_ Introducing Manifest V3
PHP recursive multi-level classification, infinite classification