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
82b8572e
Commit
82b8572e
authored
Jul 22, 2022
by
吴永生#A02208
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: MySwitch组件开发
parent
6d76e3a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
28 deletions
+58
-28
MySelect.tsx
src/components/mui/MySelect.tsx
+12
-1
MySwitch.tsx
src/components/mui/MySwitch.tsx
+46
-27
No files found.
src/components/mui/MySelect.tsx
View file @
82b8572e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2021-12-04 15:46:25
* @Date: 2021-12-04 15:46:25
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-21 1
5:54:59
* @LastEditTime: 2022-07-21 1
8:00:58
* @FilePath: /lionet-slb-pc/src/components/SearchView/components/Collapse.tsx
* @FilePath: /lionet-slb-pc/src/components/SearchView/components/Collapse.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -67,6 +67,17 @@ export default function MySelect(props: IProps) {
...
@@ -67,6 +67,17 @@ export default function MySelect(props: IProps) {
},
},
},
},
MuiMenuItem
:
{
styleOverrides
:
{
root
:
{
":hover"
:
{
backgroundColor
:
"#ECF4FF "
,
color
:
"#1370FF"
,
},
},
},
},
MuiOutlinedInput
:
{
MuiOutlinedInput
:
{
styleOverrides
:
{
styleOverrides
:
{
root
:
{
root
:
{
...
...
src/components/mui/MySwitch.tsx
View file @
82b8572e
import
*
as
React
from
'react'
;
/*
import
Switch
from
'@mui/material/Switch'
;
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-11 11:56:58
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-21 18:30:18
* @FilePath: /bkunyun/src/components/mui/MySwitch.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
*
as
React
from
"react"
;
import
Switch
,
{
SwitchProps
}
from
"@mui/material/Switch"
;
import
{
ThemeProvider
,
createTheme
}
from
"@mui/material/styles"
;
import
{
ThemeProvider
,
createTheme
}
from
"@mui/material/styles"
;
interface
IMySwitchProps
extends
SwitchProps
{
type
IMySwitchProps
=
{
value
:
boolean
;
value
:
boolean
;
onChange
?:
any
;
onChange
?:
any
;
disabled
?:
boolean
;
disabled
?:
boolean
;
}
}
const
theme
=
createTheme
({
const
theme
=
createTheme
({
...
@@ -15,29 +21,28 @@ const theme = createTheme({
...
@@ -15,29 +21,28 @@ const theme = createTheme({
MuiSwitch
:
{
MuiSwitch
:
{
styleOverrides
:
{
styleOverrides
:
{
root
:
{
root
:
{
height
:
'22px'
,
boxSizing
:
"border-box"
,
width
:
'40px'
,
padding
:
"0"
,
boxSizing
:
'border-box'
,
},
padding
:
'0'
,
switchBase
:
{
},
top
:
"4px"
,
switchBase
:{
left
:
"4px"
,
top
:
'4px'
,
left
:
'4px'
,
padding
:
0
,
padding
:
0
,
'&.Mui-checked'
:
{
"&.Mui-checked"
:
{
left
:
'2px'
,
left
:
"2px"
,
'& + .MuiSwitch-track'
:
{
"& + .MuiSwitch-track"
:
{
backgroundColor
:
"#1370ff"
,
opacity
:
1
,
opacity
:
1
,
}
},
},
},
},
},
thumb
:
{
thumb
:
{
width
:
'14px'
,
width
:
"14px"
,
height
:
'14px'
,
height
:
"14px"
,
color
:
'#fff'
color
:
"#fff"
,
},
},
track
:
{
track
:
{
borderRadius
:
'11px'
,
borderRadius
:
"11px"
,
backgroundColor
:
"#E6E8EB"
,
backgroundColor
:
"#E6E8EB"
,
opacity
:
1
,
opacity
:
1
,
},
},
...
@@ -46,15 +51,29 @@ const theme = createTheme({
...
@@ -46,15 +51,29 @@ const theme = createTheme({
},
},
});
});
const
MySwitch
=
(
props
:
IMySwitchProps
)
=>
{
const
MySwitch
=
(
props
:
IMySwitchProps
)
=>
{
const
{
value
,
onChange
,
disabled
=
false
}
=
props
;
const
{
value
,
onChange
,
disabled
=
false
,
size
,
...
other
}
=
props
;
return
(
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
ThemeProvider
theme=
{
theme
}
>
<
Switch
checked=
{
value
}
disabled=
{
disabled
}
onChange=
{
onChange
}
/>
<
Switch
checked=
{
value
}
disabled=
{
disabled
}
onChange=
{
onChange
}
sx=
{
size
===
"medium"
?
{
width
:
44
,
height
:
24
,
}
:
{
width
:
40
,
height
:
22
,
}
}
{
...
other
}
/>
</
ThemeProvider
>
</
ThemeProvider
>
)
);
}
}
;
export
default
MySwitch
;
export
default
MySwitch
;
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