Commit c4da84f3 by xiexiaoqin

fix:swipe when scroll

parent 46d5f471
......@@ -152,3 +152,9 @@
justify-content: center;
align-items: center;
}
.scroll-lock {
height: 100%;
overflow-y: hidden;
position: fixed;
}
\ No newline at end of file
<import src="../../template/affairBlank/index.axml"/>
<scroll-view a:if="{{dynamicList.length !== 0}}" scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<view class="{{isStopBodyScroll ? 'scroll-lock' : ''}}" onTap="closeSwipe" onTouchStart="closeSwipe">
<view a:if="{{dynamicList.length !== 0}}" scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<view class="dynamicList">
<swipe rightWidth="{{ 78 }}" leftWidth="{{ 0 }}" a:for="{{dynamicList}}" class="dynamicContent">
<swipe onSetBodyDisableScroll="setBodyDisableScroll" rightWidth="{{ 78 }}" leftWidth="{{ 0 }}" a:for="{{dynamicList}}" class="dynamicContent">
<view class="dynamicDetails">
<view class="meetingtitle">
<view>
......@@ -29,7 +30,8 @@
</view>
</swipe>
</view>
</scroll-view>
<view class="noDate" a:else>
</view>
<view class="noDate" a:else>
<template is="affair-placeholder" data="{{title: '展示安排的所有动态', tip: '实时同步所有事件的最新动态,便于随时处理工作内容'}}"/>
</view>
</view>
\ No newline at end of file
......@@ -4,9 +4,12 @@ import {
updateMeetingTask
} from "../../api/request";
import { dealFileTime, uniqueObject } from "../../utils/utils";
Component({
import create from 'dd-store';
create.Component({
mixins: [],
data: {
isStopBodyScroll: false,
isTop: false,
isTouchMove: false,
touchMoveId: "",
......@@ -24,6 +27,15 @@ Component({
didUpdate() { },
didUnmount() { },
methods: {
setBodyDisableScroll(isStopBodyScroll) {
this.setData({
isStopBodyScroll
})
},
//点击页面关闭侧滑模块
closeSwipe() {
this.$store.closeActiveSwipe()
},
getPages(current) {
let that = this;
let data = {
......
{
"component": true,
"disableScroll": true,
"usingComponents": {
"task-list": "../../components/taskList/taskList",
"file-list": "../../components/fileList/fileList",
......
<view disable-scroll="{{true}}" class="swipe-cell" data-key="cell" catchTap="onClick" catchTouchStart="startDrag" catchTouchMove="onDrag" catchTouchEnd="endDrag" catchTouchCancel="endDrag">
<view class="swipe-cell" data-key="cell" catchTap="onClick" catchTouchStart="startDrag" catchTouchMove="onDrag" catchTouchEnd="endDrag" catchTouchCancel="endDrag">
<view style="{{ wrapperStyle }}">
<view a:if="{{ leftWidth }}" class="swipe-cell__left" data-key="left" catchTap="onClick">
<slot name="left" />
......
import create from 'dd-store';
var MIN_DISTANCE = 10;
var THRESHOLD = 0.3;
function getDirection(x, y) {
......@@ -19,7 +20,7 @@ let ARRAY = [];
function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
Component({
create.Component({
mixins: [],
offset: 0,
data: {
......@@ -73,8 +74,11 @@ Component({
if (this.direction !== 'horizontal') {
return;
}
//设置页面禁止竖向滚动
this.props.onSetBodyDisableScroll(true);
//滑动的时候不要过度时间,否则不跟手势的感觉
this.dragging = true;
// 其他组件归位
ARRAY.filter((item) => { return item !== this }).forEach(function (item) { return item.close(); });
this.swipeMove(this.startOffset + this.deltaX);
......@@ -109,11 +113,19 @@ Component({
else {
this.swipeMove(0);
}
//恢复页面竖向滚动
this.props.onSetBodyDisableScroll(false);
},
open: function (position) {
const { leftWidth, rightWidth } = this.props;
var offset = position === 'left' ? leftWidth : -rightWidth;
this.swipeMove(offset);
//向父组件暴露关闭方法
this.$store.closeActiveSwipe = () => {
this.close();
}
this.update();
},
},
});
版本175
{{tabBarIndex}}
<view style="position:absolute">
版本175
</view>
<view a:if="{{tabBarIndex === '0'}}">
<my-dynamic>
</my-dynamic>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment