|
发表于 2017-7-25 09:23:31
|
显示全部楼层
可以
接管触摸开始、触摸移动、触摸结束三个方法,在触摸开始方法里用自定义定时器,比如3秒触发。然后在触摸移动和结束方法里结束这个定时器。达到这个效果- /**
- * 触摸开始
- *
- * @param event
- */
- Model.prototype.li3Touchstart = function(event) {
- var self = this;
- var row = event.bindingContext.$object;// 获取当前行的数据
- var li = event.currentTarget;
- // / $(li).attr("style", "");
- if (row.val("state") == "10I") {
- this._timer = setTimeout(function() {
- layer.confirm('您确定删除该提案?', {
- btn : [ '确定', '取消' ],
- title : '提示',
- closeBtn : 1, // 关闭按钮1、2显示不同样式,0不显示
- shift : 4,// 0-6动画
- }, function(index) {
- var params = {
- "userId" : self._USER_INFO.userId,
- "proposalCode" : row.val("proposalCode")
- };
- var success = function(resultData) {
- if (resultData.returnCode == 1000) {
- var proposalData = self.comp("proposalData");
- proposalData.remove(row);
- layer.msg('删除成功', {
- icon : 1,
- time : 800,
- });
- } else {
- layer.msg(resultData.returnMsg);
- }
- };
- var timeoutCallback = function(resultData) {
- layer.msg("请求超时!");
- };
- Baas.sendRequest({
- "async" : 'true',
- // "url" : MyConst.,
- "params" : params,
- "success" : success,
- "timeout" : 15000,// 请求超时,毫秒
- "timeoutCallback" : timeoutCallback
- });
- }, function(index) {
- layer.close(index);
- });
- }, 600);
- }
- };
- /**
- * 触摸移动
- *
- * @param event
- */
- Model.prototype.li3Touchmove = function(event) {
- var li = event.currentTarget;
- // $(li).attr("style", "");
- clearTimeout(this._timer);
- };
- /**
- * 触摸结束
- *
- * @param event
- */
- Model.prototype.li3Touchend = function(event) {
- var li = event.currentTarget;
- // $(li).attr("style", "");
- clearTimeout(this._timer);
- };
复制代码 |
|