我尝试在双击事件(在表格字段中)显示弹出窗口,所以我通过knockout方法添加此操作。此事件在浏览器中有效,但它不适用于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);
}
答案 0 :(得分:1)
用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事件中,我的弹出窗口出现了。