修改时间冒泡的问题,调整电表详情
This commit is contained in:
@@ -23,7 +23,7 @@ Component({
|
||||
if (newActive === 0) {
|
||||
this.setData({ scrollLeft: 0 })
|
||||
} else if (newActive > 0) {
|
||||
this.setData({ scrollLeft: 220 * newList.length - 20 })
|
||||
this.setData({ scrollLeft: (220 * (newActive) - 20) + "rpx" })
|
||||
}
|
||||
const { scrollWidth } = this.data;
|
||||
if (scrollWidth) {
|
||||
@@ -114,7 +114,8 @@ Component({
|
||||
// });
|
||||
// },
|
||||
|
||||
scrollLeft() {
|
||||
handleScrollLeft() {
|
||||
console.log("left--------------")
|
||||
// 向左滚动:减少 scrollLeft,但不能小于0
|
||||
const newScrollLeft = Math.max(0, this.data.scrollLeft - 200);
|
||||
this.setData({
|
||||
@@ -122,7 +123,8 @@ Component({
|
||||
});
|
||||
},
|
||||
|
||||
scrollRight() {
|
||||
handleScrollRight() {
|
||||
console.log("right-----------------")
|
||||
// 向右滚动:增加 scrollLeft,但不能超过 maxScrollLeft
|
||||
const newScrollLeft = Math.min(this.data.maxScrollLeft, this.data.scrollLeft + 200);
|
||||
this.setData({
|
||||
|
@@ -5,13 +5,13 @@
|
||||
<text> 电表列表 (总计{{list.length}}块,已抄{{list.length - finishNumber}}块) </text>
|
||||
</view>
|
||||
<view style="display: flex; align-items: center;margin-top: 20rpx;">
|
||||
<van-icon name="arrow-left" size="50rpx" bind:tap="scrollLeft" />
|
||||
<!-- <van-icon name="arrow-left" size="50rpx" bind:tap="handleScrollLeft" /> -->
|
||||
<scroll-view
|
||||
scroll-x="{{true}}"
|
||||
class="meterListScrollView"
|
||||
scroll-left="{{scrollLeft}}"
|
||||
bindscroll="onScroll"
|
||||
scroll-with-animation="true"
|
||||
scroll-with-animation="{{true}}"
|
||||
scroll-anchoring="{{true}}"
|
||||
>
|
||||
<view style="display: flex;" class="scroll-content">
|
||||
<meter-item
|
||||
@@ -19,14 +19,13 @@
|
||||
wx:for="{{list}}"
|
||||
wx:key="id"
|
||||
meter="{{item}}"
|
||||
bind:click="handleSelect"
|
||||
catch:click="handleSelect"
|
||||
data-index="{{index}}"
|
||||
data-id="{{item.meterId}}"
|
||||
status="{{item.status}}"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<van-icon name="arrow" size="50rpx" bind:tap="scrollRight" />
|
||||
<!-- <van-icon name="arrow" size="50rpx" bind:tap="handleScrollRight" /> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
Reference in New Issue
Block a user