From 38430ddb8612fce15a2f1c940f9bd57d4da3e70b Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 16 九月 2021 11:59:39 +0800
Subject: [PATCH] add new key
---
components/uni-list/uni-refresh.wxs | 174 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 87 insertions(+), 87 deletions(-)
diff --git a/components/uni-list/uni-refresh.wxs b/components/uni-list/uni-refresh.wxs
index 9ef364e..818a6b7 100644
--- a/components/uni-list/uni-refresh.wxs
+++ b/components/uni-list/uni-refresh.wxs
@@ -1,87 +1,87 @@
-var pullDown = {
- threshold: 95,
- maxHeight: 200,
- callRefresh: 'onrefresh',
- callPullingDown: 'onpullingdown',
- refreshSelector: '.uni-refresh'
-};
-
-function ready(newValue, oldValue, ownerInstance, instance) {
- var state = instance.getState()
- state.canPullDown = newValue;
- // console.log(newValue);
-}
-
-function touchStart(e, instance) {
- var state = instance.getState();
- state.refreshInstance = instance.selectComponent(pullDown.refreshSelector);
- state.canPullDown = (state.refreshInstance != null && state.refreshInstance != undefined);
- if (!state.canPullDown) {
- return
- }
-
- // console.log("touchStart");
-
- state.height = 0;
- state.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY;
- state.refreshInstance.setStyle({
- 'height': 0
- });
- state.refreshInstance.callMethod("onchange", true);
-}
-
-function touchMove(e, ownerInstance) {
- var instance = e.instance;
- var state = instance.getState();
- if (!state.canPullDown) {
- return
- }
-
- var oldHeight = state.height;
- var endY = e.touches[0].pageY || e.changedTouches[0].pageY;
- var height = endY - state.touchStartY;
- if (height > pullDown.maxHeight) {
- return;
- }
-
- var refreshInstance = state.refreshInstance;
- refreshInstance.setStyle({
- 'height': height + 'px'
- });
-
- height = height < pullDown.maxHeight ? height : pullDown.maxHeight;
- state.height = height;
- refreshInstance.callMethod(pullDown.callPullingDown, {
- height: height
- });
-}
-
-function touchEnd(e, ownerInstance) {
- var state = e.instance.getState();
- if (!state.canPullDown) {
- return
- }
-
- state.refreshInstance.callMethod("onchange", false);
-
- var refreshInstance = state.refreshInstance;
- if (state.height > pullDown.threshold) {
- refreshInstance.callMethod(pullDown.callRefresh);
- return;
- }
-
- refreshInstance.setStyle({
- 'height': 0
- });
-}
-
-function propObserver(newValue, oldValue, instance) {
- pullDown = newValue;
-}
-
-module.exports = {
- touchmove: touchMove,
- touchstart: touchStart,
- touchend: touchEnd,
- propObserver: propObserver
-}
+var pullDown = {
+ threshold: 95,
+ maxHeight: 200,
+ callRefresh: 'onrefresh',
+ callPullingDown: 'onpullingdown',
+ refreshSelector: '.uni-refresh'
+};
+
+function ready(newValue, oldValue, ownerInstance, instance) {
+ var state = instance.getState()
+ state.canPullDown = newValue;
+ // console.log(newValue);
+}
+
+function touchStart(e, instance) {
+ var state = instance.getState();
+ state.refreshInstance = instance.selectComponent(pullDown.refreshSelector);
+ state.canPullDown = (state.refreshInstance != null && state.refreshInstance != undefined);
+ if (!state.canPullDown) {
+ return
+ }
+
+ // console.log("touchStart");
+
+ state.height = 0;
+ state.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY;
+ state.refreshInstance.setStyle({
+ 'height': 0
+ });
+ state.refreshInstance.callMethod("onchange", true);
+}
+
+function touchMove(e, ownerInstance) {
+ var instance = e.instance;
+ var state = instance.getState();
+ if (!state.canPullDown) {
+ return
+ }
+
+ var oldHeight = state.height;
+ var endY = e.touches[0].pageY || e.changedTouches[0].pageY;
+ var height = endY - state.touchStartY;
+ if (height > pullDown.maxHeight) {
+ return;
+ }
+
+ var refreshInstance = state.refreshInstance;
+ refreshInstance.setStyle({
+ 'height': height + 'px'
+ });
+
+ height = height < pullDown.maxHeight ? height : pullDown.maxHeight;
+ state.height = height;
+ refreshInstance.callMethod(pullDown.callPullingDown, {
+ height: height
+ });
+}
+
+function touchEnd(e, ownerInstance) {
+ var state = e.instance.getState();
+ if (!state.canPullDown) {
+ return
+ }
+
+ state.refreshInstance.callMethod("onchange", false);
+
+ var refreshInstance = state.refreshInstance;
+ if (state.height > pullDown.threshold) {
+ refreshInstance.callMethod(pullDown.callRefresh);
+ return;
+ }
+
+ refreshInstance.setStyle({
+ 'height': 0
+ });
+}
+
+function propObserver(newValue, oldValue, instance) {
+ pullDown = newValue;
+}
+
+module.exports = {
+ touchmove: touchMove,
+ touchstart: touchStart,
+ touchend: touchEnd,
+ propObserver: propObserver
+}
--
Gitblit v1.8.0