pixuireactcomponents 1.3.88 → 1.3.89
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'preact/hooks';
|
|
1
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
2
2
|
import { h } from 'preact';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -16,10 +16,18 @@ export var DropDown = function (props) {
|
|
|
16
16
|
var _a;
|
|
17
17
|
var rootId = props.rootId, rootClassName = props.rootClassName, spreadFrameClassName = props.spreadFrameClassName, mainItemClassName = props.mainItemClassName, itemClassName = props.itemClassName, mainContent = props.mainContent, itemContent = props.itemContent, onClick = props.onClick, onSpread = props.onSpread;
|
|
18
18
|
var spread = (_a = useState(false), _a[0]), setSpread = _a[1];
|
|
19
|
+
//导出ref
|
|
20
|
+
if (props.compRef) {
|
|
21
|
+
props.compRef.current = {
|
|
22
|
+
setSpread: setSpread,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
onSpread && onSpread(spread);
|
|
27
|
+
}, [spread]);
|
|
19
28
|
return (h("div", { style: { flexDirection: 'column', flexShrink: 0 }, className: rootClassName, id: rootId },
|
|
20
29
|
h("div", { onClick: function () {
|
|
21
30
|
setSpread(!spread);
|
|
22
|
-
onSpread && onSpread(!spread);
|
|
23
31
|
}, className: mainItemClassName, style: { flexShrink: 0 } }, mainContent),
|
|
24
32
|
spread && (
|
|
25
33
|
//在下方展开
|