Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
88d9c550
Commit
88d9c550
authored
Oct 31, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tabs切换记住activetab 刷新也保持
parent
287ce476
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
index.tsx
src/components/mui/MyTabs/index.tsx
+10
-0
index.tsx
...sources/WorkflowOperator/components/AddOperator/index.tsx
+1
-1
index.tsx
src/views/ResourceCenter/UserResources/index.tsx
+1
-0
No files found.
src/components/mui/MyTabs/index.tsx
View file @
88d9c550
...
@@ -15,6 +15,7 @@ import { ThemeProvider, createTheme } from "@mui/material/styles";
...
@@ -15,6 +15,7 @@ import { ThemeProvider, createTheme } from "@mui/material/styles";
import
{
TabContext
,
TabList
,
TabPanel
}
from
"@mui/lab"
;
import
{
TabContext
,
TabList
,
TabPanel
}
from
"@mui/lab"
;
import
{
Typography
}
from
"@mui/material"
;
import
{
Typography
}
from
"@mui/material"
;
import
classNames
from
"classnames"
;
import
classNames
from
"classnames"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
...
@@ -46,6 +47,8 @@ interface IProps {
...
@@ -46,6 +47,8 @@ interface IProps {
tabPanelSx
?:
any
;
tabPanelSx
?:
any
;
/** 是否允许空值 */
/** 是否允许空值 */
allowNullValue
?:
boolean
;
allowNullValue
?:
boolean
;
/** 路由地址 配合navigate和MyTabs组件的defaultValue组合使用、F5刷新也可以保存激活的tab */
navigateUrl
?:
string
;
}
}
const
theme
=
createTheme
({
const
theme
=
createTheme
({
...
@@ -101,8 +104,11 @@ const Tabs = (props: IProps) => {
...
@@ -101,8 +104,11 @@ const Tabs = (props: IProps) => {
tabPanelSx
=
{
padding
:
"20px 0 0 0"
},
tabPanelSx
=
{
padding
:
"20px 0 0 0"
},
title
,
title
,
titleClass
,
titleClass
,
navigateUrl
,
}
=
props
;
}
=
props
;
const
navigate
=
useNavigate
();
const
[
tabValue
,
setTabValue
]
=
useState
(
const
[
tabValue
,
setTabValue
]
=
useState
(
defaultValue
defaultValue
?
defaultValue
?
defaultValue
...
@@ -116,6 +122,10 @@ const Tabs = (props: IProps) => {
...
@@ -116,6 +122,10 @@ const Tabs = (props: IProps) => {
const
onTabChange
=
(
val
:
string
)
=>
{
const
onTabChange
=
(
val
:
string
)
=>
{
setTabValue
(
val
);
setTabValue
(
val
);
onChange
&&
onChange
(
val
);
onChange
&&
onChange
(
val
);
navigateUrl
&&
navigate
(
navigateUrl
,
{
state
:
{
defaultTab
:
val
},
});
};
};
const
getImgSrc
=
useCallback
(
const
getImgSrc
=
useCallback
(
...
...
src/views/ResourceCenter/UserResources/WorkflowOperator/components/AddOperator/index.tsx
View file @
88d9c550
...
@@ -499,7 +499,7 @@ const AddOperator = observer((props: IAddOperator) => {
...
@@ -499,7 +499,7 @@ const AddOperator = observer((props: IAddOperator) => {
style={{
style={{
position: "absolute",
position: "absolute",
fontSize: "14px",
fontSize: "14px",
bottom: "7
px",
top: "96
px",
right: "12px",
right: "12px",
color:
color:
Number(formData?.description?.length) >= 300
Number(formData?.description?.length) >= 300
...
...
src/views/ResourceCenter/UserResources/index.tsx
View file @
88d9c550
...
@@ -40,6 +40,7 @@ const UserResources = () => {
...
@@ -40,6 +40,7 @@ const UserResources = () => {
tabList=
{
tabList
}
tabList=
{
tabList
}
defaultValue=
{
location
?.
state
?.
defaultTab
||
"USERRESOURCES_TEMPLATE"
}
defaultValue=
{
location
?.
state
?.
defaultTab
||
"USERRESOURCES_TEMPLATE"
}
tabPanelSx=
{
{
padding
:
"0"
}
}
tabPanelSx=
{
{
padding
:
"0"
}
}
navigateUrl=
"/utility/resourceCenter/userResources"
/>
/>
{
/* <OperatorDetails /> */
}
{
/* <OperatorDetails /> */
}
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment