- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的按钮处理程序被调用了两次 - 一次用于 mousedown/touchstart,第二次用于 mouseup/touchend。
这在我的 iPhone 设备和 Chrome 浏览器中都会发生。
使用 ST 1.1
我还没有找到任何关于这个问题的引用资料,这似乎表明我的环境中有什么东西是错误的,但我已经没有东西可以检查了......
在 Chrome DevTools 中检查传递给处理程序的事件对象,我可以看到它们都是模拟的“点击”事件,第一个来自“mousedown”,第二个来自“mouseup”。
有什么想法吗?
编辑:
我发现当我向 Ext.EventManager.onDocumentReady
添加调用(即使处理程序为空)时会发生这种情况。
如果我删除此调用,我只会按预期获得对“mouseup”的点击。
如果我用 Ext.onReady
替换它,它就可以工作!!!这真是令人困惑,因为一个是另一个的别名......
代码复现:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="resources/Sencha/sencha-touch-debug.js" type="text/javascript"></script>
<link href="resources/Sencha/sencha-touch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
MyPanel = Ext.extend(Ext.Panel, {
fullscreen: true,
initComponent: function() {
this.items = [{
xtype: 'button',
text: 'Login',
handler: this.myHandler,
scope: this
}];
MyPanel.superclass.initComponent.apply(this, arguments);
},
myHandler: function(b, e) {
console.log(e.event.type);
}
});
Ext.EventManager.onDocumentReady(function() {
});
Ext.onReady(function() {
new MyPanel();
});
</script>
</head>
<body></body>
</html>
最佳答案
我在使用未修饰的链接节点时遇到过这个问题。我设法通过在 A
节点上吃 touchend
事件来修复它:
document.addEventListener('touchend', function(e) {
e.preventDefault() if e.target.localName == 'a')
}, true);
这不完全是你的问题,但很可能你的问题是类似的,由 touch 和 click
事件发送到小部件引起。 Here这是我用来向我的控制台发送尽可能多的所有事件(即原始 DOM 事件,而不是 Ext 事件)的垃圾邮件的方法。它对于解决此类低级问题很有用。
关于sencha-touch - Sencha 触摸 : Button handler called twice for single click - why?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6457220/
我不知道该在标题中添加什么内容,但我有以下代码: @Controller public class WorkdayAddController { @Autowired private WorkdayR
已编辑:我需要用户按其全局进度 [order by avg(progression) DESC] 以及按进度排序的详细信息行进行排序。 示例: USER 1 campaign 1 progressio
我知道这是一个更“沉重”的问题,但我认为它也很有趣。它是 of my previous questions about compiler functions 的一部分, 但回过头来我解释得非常糟糕,许
我有一个函数(表单中的事件处理程序)结构如下: Dim errMsg as String = "" CheckIfValidUser(..., errMsg) If errMsg.Length > 0
我正在为客户正在举办的事件创建注册表。基本的用户详细信息被提交到第三方系统(即姓名、电子邮件等),但其余字段需要通过电子邮件发送给客户。 我需要这样的事情发生: 列出项目 用户填写表单 jquery
我有一个ClassLoader,它从源文件加载由JavaCompiler编译的类。但是当我更改源文件、保存它并重新编译它时,ClassLoader 仍然加载该类的第一个版本。 ClassLoad
我有一个使用 Kotlin 编写的 RecognitionListener 的项目。语音转文本功能一直很成功,从未出现任何问题。 从上周开始,它的 onResult 函数开始被调用两次。该项目没有进行
大家好(和圣诞快乐) 希望有人能回答我的问题,那将是一个美好的圣诞节 礼物。 我的 UIViewController 一个表,在表部分区域中有一个分段控件。看起来像这样 每次用户单击分段控件时,我都会
我正在制作一个程序,输入三个数字,然后计算一些不同的东西(每个东西都必须有自己的函数)。该程序首先告诉用户他们的选择并等待他们的输入。执行任何情况后,程序将再次打印菜单,除非它将使用默认情况,然后它将
我的 Android 应用程序有一个自定义接收器,如下所示: public class CustomReceiver extends BroadcastReceiver{ String URL; St
我有一系列带日期的事件,如下所示: 事件 1,2014 年 1 月 1 日 事件 2,2014 年 1 月 2 日 事件 3,2014 年 1 月 3 日 假设我想要按时间顺序排列的最近两个事件。如果
我对 jQuery“切换”方法有一个神秘的问题。我单击它一次,但它会设置两次动画。你自己去看看吧! Demo 页面源码贴在下面,(解决后链接会消失) html: About us S
我对Python完全陌生,当我遇到这个问题时,我正在尝试线程模块:-线程由于某种原因运行两次,我不知道为什么。我到处寻找,但没有找到任何答案。希望我能在这里得到一些帮助 import time fro
先决条件:无障碍对讲开启。 问题:当从软键盘向编辑文本输入字符时,字符被读出两次。(我想一次是通过键盘,一次是通过编辑文本)。 最佳答案 问题:视力正常的用户不能很好地理解/理解盲人用户需要的信息类型
我的问题是,当我再次对相同的值进行评分时,它不会响应第二次..这意味着当我第一次评分为“4”时,我不能将其评分为“4”第二次..只有当我评价其他值而不是'4'时它才会响应。 这是我尝试过的(我的代码中
我必须设计一个问卷系统。我们一直在讨论很多事情,包括如何持有答案,以及如何持有可能的答案。现在,尽管我不同意,但我还是屈服于我的同事。我只想知道您对此的看法以及原因。对我来说,两次保存相同的信息是一个
我将 Angular2 与路由一起使用,我的页面在初始加载时显示重复内容。单击任何链接(Page1 或 Page2)后,一切正常(不再有重复内容)。为什么我在初始加载时得到重复的内容以及我需要什么才能
我用KTX。。我有以下代码:。为什么它显示了两次?我该如何解决这个问题呢?。。预计“点击开始游戏”的标签只会显示一次。。我试着删除了代码。但它还是发生了。。然后,我尝试删除Add(LoadingSta
现象说明 maven的java项目,测试用例和main所在的源码文件均符合缺省写法和格式,但是在使用mvn clean sonar:sonar进行编译时提示can't be indexed twi
我使用 React 创建了一个简单的 Meteor 应用程序。它使用名为 client 的文件夹中的三个文件(没有其他文件)。在控制台中,应用程序打印出: withTracker rendering
我是一名优秀的程序员,十分优秀!