pixuireactcomponents 1.3.57 → 1.3.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,13 +9,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* + [已解决]为什么重新创建 CustomScrollBar()时 isDragingSBlock 会被重置为false? 在外部回调中不能使用state
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
12
|
import { h } from 'preact';
|
|
17
|
-
import
|
|
18
|
-
import { useState, useEffect } from 'preact/hooks';
|
|
13
|
+
import { useImperativeHandle, useState, useEffect } from 'preact/hooks';
|
|
19
14
|
var sWindow; // 滚动窗口
|
|
20
15
|
var sBlock; // 滚动条
|
|
21
16
|
var sFrame; // 滚动条外框
|
|
@@ -119,8 +114,20 @@ export function ScrollBar(props) {
|
|
|
119
114
|
sWindow.scrollTop = content_scrollTop;
|
|
120
115
|
}
|
|
121
116
|
};
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
useImperativeHandle(props.eventRef, function () { return ({
|
|
118
|
+
scrollTo: scrollTo,
|
|
119
|
+
}); });
|
|
120
|
+
// 重设滚动轴, x预留, y为距离顶部的像素值
|
|
121
|
+
var scrollTo = function (x, y) {
|
|
122
|
+
if (typeof y === 'number') {
|
|
123
|
+
sWindow.scrollTop = y;
|
|
124
|
+
}
|
|
125
|
+
// 停止滚动
|
|
126
|
+
sWindow.style.overflow = 'hidden';
|
|
127
|
+
sWindow.style.overflow = 'scroll';
|
|
128
|
+
};
|
|
129
|
+
return (h("div", { id: "sframe", style: sFrameStyle },
|
|
130
|
+
h("div", { id: "sblock", style: sBlockStyle, draggable: true, onDragStart: function (event) {
|
|
124
131
|
sBlock.style.backgroundImage = "url(".concat(props.sBlockImgClick, ")");
|
|
125
132
|
sFrame.style.backgroundImage = "url(".concat(props.sFrameImgClick, ")");
|
|
126
133
|
//@ts-ignore
|