我尝试在双击事件(在表字段中)中显示弹出窗口,因此我通过敲除方法添加了此操作。此事件在浏览器中有效,但在ios或android平台上无效。我应该怎么做才能解决这个问题?
<div class="contentContainer" data-bind="dxScrollView: { direction: 'vertical' }">
<div class="dx-fieldset">
<div data-bind="foreach: finalDataSource">
<div class="dx-field">
<div class="dataKey dx-field-label" data-bind="text: $data.ColumnName, event: { dblclick: $root.showPopup }"></div>
<div class="dataValue inp dx-field-value" data-bind="
dxTextBox: { enable: false, value: $data.Value, clickAction: $root.inpClick }">
</div>
</div>
</div>
</div>
</div>
function showPopup(sender) {
MyApp.app.column.id(sender.ColumnId);
MyApp.app.column.name(sender.ColumnName);
getPopupDataSource();
popupVisible(true);
}
最佳答案
问题通过Hammer.js解决
var elements = document.getElementsByClassName('dataKey');
for (i = 0; i < elements.length; i++) {
Hammer(elements[i]).on("doubletap", function (event) {
showPopup(ko.dataFor(event.srcElement));
});
}
此操作从“ viewShown”开始
现在在doubleTap事件上,我的弹出窗口出现。