...
|
...
|
@@ -21,11 +21,6 @@ Component({ |
|
|
value: '',
|
|
|
observer: '_selectChange'
|
|
|
},
|
|
|
touchKey: {
|
|
|
type: String,
|
|
|
value: '',
|
|
|
observer: '_touchChange'
|
|
|
},
|
|
|
isInvalid: {
|
|
|
type: Boolean,
|
|
|
value: false
|
...
|
...
|
@@ -113,8 +108,10 @@ Component({ |
|
|
}
|
|
|
},
|
|
|
toggleAnimation(isShow) {
|
|
|
this._isShowMore = isShow;
|
|
|
this.setData({scrollLeft: isShow ? this.data.slideWidth : 0});
|
|
|
if (this._isShowMore !== isShow || (!isShow && this._scollLeft > 0)) {
|
|
|
this._isShowMore = isShow;
|
|
|
this.setData({scrollLeft: isShow ? this.data.slideWidth : 0});
|
|
|
}
|
|
|
},
|
|
|
touchStartAction(e) {
|
|
|
this._touchStart = false;
|
...
|
...
|
@@ -138,11 +135,14 @@ Component({ |
|
|
return;
|
|
|
}
|
|
|
|
|
|
let slideWidth = this.data.slideWidth;
|
|
|
let touchEnd = e.changedTouches[0];
|
|
|
|
|
|
let offsetX = this._touchStart.clientX - touchEnd.clientX;
|
|
|
|
|
|
if (offsetX > 0) {
|
|
|
if (offsetX >= slideWidth) {
|
|
|
this._isShowMore = true;
|
|
|
} else if (offsetX > 0) {
|
|
|
let show = false;
|
|
|
|
|
|
if (offsetX > this.data.slideWidth * 0.3) {
|
...
|
...
|
@@ -152,6 +152,9 @@ Component({ |
|
|
this.toggleAnimation(show);
|
|
|
}
|
|
|
},
|
|
|
onScoll(e) {
|
|
|
this._scollLeft = e.detail.scrollLeft;
|
|
|
},
|
|
|
chooseItemAction() {
|
|
|
let item = {...this.data.item};
|
|
|
|
...
|
...
|
@@ -187,5 +190,15 @@ Component({ |
|
|
editGoodsColorSize(e) {
|
|
|
this.triggerEvent('editGoodsColorSize', e.detail);
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
let pages = getCurrentPages();
|
|
|
let currentPage = pages[pages.length - 1];
|
|
|
|
|
|
if (currentPage && currentPage.event && currentPage.event.on) {
|
|
|
currentPage.event.on('cart-touch-start', key => {
|
|
|
this._touchChange(key);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}); |
...
|
...
|
|