@hzab/sider 0.0.2 → 0.0.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/sider",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "侧边栏",
5
5
  "main": "lib",
6
6
  "scripts": {
@@ -23,9 +23,9 @@
23
23
  "@types/react-dom": "^18.0.9",
24
24
  "eslint": "^8.30.0",
25
25
  "less": "^4.1.3",
26
- "react": "^18.2.0",
27
- "react-dom": "^18.2.0",
28
- "react-router-dom": "^6.8.1",
26
+ "react": "^17.0.2",
27
+ "react-dom": "^17.0.2",
28
+ "react-router-dom": "^6.14.1",
29
29
  "typescript": "^4.9.4"
30
30
  },
31
31
  "directories": {
package/src/index.tsx CHANGED
@@ -11,7 +11,7 @@ function Sider(props) {
11
11
  const location = useLocation();
12
12
  const [selected, setSelected] = useState([location.pathname]);
13
13
  const [open, setOpen] = useState(location.pathname.split(/(?=\/)/)?.slice(0, 1));
14
- const [menus, setMenus] = useState(props.menus || []);
14
+ const [menus, setMenus] = useState(_.cloneDeep(props.menus) || []);
15
15
 
16
16
  useEffect(() => {
17
17
  const keyPaths: Array<string> = location.pathname.split(/(?=\/)/);
@@ -42,7 +42,7 @@ function Sider(props) {
42
42
  iconDom = React.createElement(Icon && (Icon as any)[iconDom], {
43
43
  style: { fontSize: "14px" },
44
44
  });
45
- } else if (iconDom?.startsWith("icon-")) {
45
+ } else if (iconDom?.startsWith && iconDom?.startsWith("icon-")) {
46
46
  iconDom = <i className={"sider-icon icon-iconfont " + iconDom}></i>;
47
47
  }
48
48
  it.icon = iconDom;
@@ -1 +0,0 @@
1
- .sider-box_V6sF9{height:100%;overflow-x:hidden;overflow-y:auto}.sider-box_V6sF9::-webkit-scrollbar{height:4px;width:4px}.sider-box_V6sF9::-webkit-scrollbar-track{background:#efefef}.sider-box_V6sF9::-webkit-scrollbar-thumb{background:hsla(220,4%,58%,.3);border-radius:4px}.sider-box_V6sF9::-webkit-scrollbar-thumb:hover{background:hsla(220,4%,58%,.5)}