data: {
bankList:[
{
‘bank‘
:
‘中国建设银行(建安支行)‘
,
‘names‘
:
‘章三‘
,
‘cardNum‘
:
‘***** ******* ***** ***0910‘
},
{
‘bank‘
:
‘中国工商银行(建安支行)‘
,
‘names‘
:
‘章三‘
,
‘cardNum‘
:
‘***** ******* ***** ***0910‘
},
],
editIndex: 0,
delBtnWidth:180
},
touchS:
function
(e) {
if
(e.touches.length == 1) {
this
.setData({
stX: e.touches[0].clientX
});
}
},
touchM:
function
(e) {
console.log(
"touchM:"
+ e);
var
that =
this
if
(e.touches.length == 1) {
var
moveX = e.touches[0].clientX;
var
disX = that.data.stX - moveX;
var
delBtnWidth = that.data.delBtnWidth;
var
txtStyle =
"true"
;
if
(disX == 0 || disX < 0){
txtStyle =
"true"
;
}
else
if
(disX > 0 ){
txtStyle =
"false"
;
}
var
index = e.currentTarget.dataset.index;
var
list = that.data.bankList;
list[index].txtStyle = txtStyle;
this
.setData({ bankList:list });
}
},
touchE:
function
(e) {
console.log(
"touchE"
+ e);
var
that =
this
if
(e.changedTouches.length == 1) {
var
endX = e.changedTouches[0].clientX;
var
disX = that.data.stX - endX;
var
delBtnWidth = that.data.delBtnWidth;
var
txtStyle = disX > delBtnWidth/2 ?
"true"
:
"false"
;
var
index = e.currentTarget.dataset.index;
var
list = that.data.bankList; list[index].txtStyle = txtStyle;
that.setData({ bankList:list });
}
},