@yuku123/z-frontend-common 0.2.2 → 0.2.4
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,5 +1,5 @@
|
|
|
1
1
|
import React, {useEffect, useRef, useState} from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {useLocation, useNavigate} from 'react-router-dom'
|
|
3
3
|
import {Avatar, Cascader, Divider, Dropdown, Layout as AntLayout, Menu, Space, Typography,} from 'antd'
|
|
4
4
|
import {
|
|
5
5
|
AppstoreOutlined,
|
|
@@ -25,7 +25,7 @@ import {getCurrentUser} from '../../services/api'
|
|
|
25
25
|
const {Header, Sider, Content} = AntLayout
|
|
26
26
|
const {Text} = Typography
|
|
27
27
|
|
|
28
|
-
const Layout = ({compact = false} = {}) => {
|
|
28
|
+
const Layout = ({compact = false, children} = {}) => {
|
|
29
29
|
const location = useLocation()
|
|
30
30
|
const navigate = useNavigate()
|
|
31
31
|
const [collapsed, setCollapsed] = useState(false)
|
|
@@ -174,11 +174,15 @@ const Layout = ({compact = false} = {}) => {
|
|
|
174
174
|
navigate(`/ctc/${key}`)
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// compact=true: 由主壳 App.jsx 提供 Layout, 这里只渲染 children (passthrough)
|
|
178
|
+
// compact=false: 独立运行时, 自己提供完整 Layout (Header + Sider + Content)
|
|
179
|
+
if (compact) {
|
|
180
|
+
return <>{children}</>
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
return (
|
|
178
184
|
<AntLayout className={styles.layout}>
|
|
179
|
-
{
|
|
180
|
-
/* 顶部导航栏 (compact 模式: 由主壳 App.jsx 提供) */
|
|
181
|
-
<>
|
|
185
|
+
{/* 顶部导航栏 */}
|
|
182
186
|
<Header className={styles.header}>
|
|
183
187
|
<div className={styles.logo}>
|
|
184
188
|
<span className={styles.logoText}>Z-CTC 统一用户中心</span>
|
|
@@ -288,8 +292,6 @@ const Layout = ({compact = false} = {}) => {
|
|
|
288
292
|
</Space>
|
|
289
293
|
</div>
|
|
290
294
|
</Header>
|
|
291
|
-
</>
|
|
292
|
-
)}
|
|
293
295
|
|
|
294
296
|
<AntLayout className={styles.mainLayout}>
|
|
295
297
|
{/* 侧边菜单 */}
|
|
@@ -318,7 +320,7 @@ const Layout = ({compact = false} = {}) => {
|
|
|
318
320
|
|
|
319
321
|
{/* 主内容区 */}
|
|
320
322
|
<Content className={styles.content}>
|
|
321
|
-
|
|
323
|
+
{children}
|
|
322
324
|
</Content>
|
|
323
325
|
</AntLayout>
|
|
324
326
|
</AntLayout>
|
package/src/index.js
CHANGED
|
@@ -40,4 +40,3 @@ export {default as MockTemplateHelper} from './components/MockPlatform/MockTempl
|
|
|
40
40
|
export {default as CurlImportModal} from './components/MockPlatform/CurlImportModal'
|
|
41
41
|
export {default as OpenApiImportModal} from './components/MockPlatform/OpenApiImportModal'
|
|
42
42
|
|
|
43
|
-
export default common
|