File tree Expand file tree Collapse file tree 9 files changed +15
-4
lines changed
sites/sites-react/doc/docs Expand file tree Collapse file tree 9 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ import { Switch } from '@nutui/nutui-react'
7777| disabled | Disabled | ` boolean ` | ` false ` |
7878| activeText | Text description when opening | ` ReactNode ` | ` - ` |
7979| inactiveText | Text description when closed | ` ReactNode ` | ` - ` |
80+ | loadingIcon | Controlled loading state icon | ` ReactNode ` | ` <Loading1 /> ` |
8081| onChange | Trigger when switching switches | ` onChange:(value: boolean, event: Event) ` | ` - ` |
8182
8283## Theming
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ import { Switch } from '@nutui/nutui-react'
7777| disabled | 禁用状态 | ` boolean ` | ` false ` |
7878| activeText | 打开时文字描述 | ` ReactNode ` | ` - ` |
7979| inactiveText | 关闭时文字描述 | ` ReactNode ` | ` - ` |
80+ | loadingIcon | 受控 loading 态图标 | ` ReactNode ` | ` <Loading1 /> ` |
8081| onChange | 切换开关时触发 | ` onChange:(value: boolean, event: Event) ` | ` - ` |
8182
8283## 主题定制
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ import { Switch } from '@nutui/nutui-react-taro'
7777| disabled | 禁用状态 | ` boolean ` | ` false ` |
7878| activeText | 打开时文字描述 | ` ReactNode ` | ` - ` |
7979| inactiveText | 关闭时文字描述 | ` ReactNode ` | ` - ` |
80+ | loadingIcon | 受控 loading 态图标 | ` ReactNode ` | ` <Loading1 /> ` |
8081| onChange | 切换开关时触发 | ` onChange:(value: boolean, event: Event) ` | ` - ` |
8182
8283## 主题定制
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ import { Switch } from '@nutui/nutui-react'
7777| disabled | 禁用狀態 | ` boolean ` | ` false ` |
7878| activeText | 打開時文字描述 | ` ReactNode ` | ` - ` |
7979| inactiveText | 關閉時文字描述 | ` ReactNode ` | ` - ` |
80+ | loadingIcon | 受控 loading 態圖標 | ` ReactNode ` | ` <Loading1 /> ` |
8081| onChange | 切換開關時觸發 | ` onChange:(value: boolean, event: Event) ` | ` - ` |
8182
8283## 主題定製
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const defaultProps = {
1313 disabled : false ,
1414 activeText : '' ,
1515 inactiveText : '' ,
16+ loadingIcon : < Loading1 /> ,
1617} as TaroSwitchProps
1718export const Switch : FunctionComponent < Partial < TaroSwitchProps > > = ( props ) => {
1819 const {
@@ -21,6 +22,7 @@ export const Switch: FunctionComponent<Partial<TaroSwitchProps>> = (props) => {
2122 disabled,
2223 activeText,
2324 inactiveText,
25+ loadingIcon,
2426 className,
2527 style,
2628 onChange,
@@ -80,8 +82,8 @@ export const Switch: FunctionComponent<Partial<TaroSwitchProps>> = (props) => {
8082 } ,
8183 ] ) }
8284 >
83- { changing ? (
84- < Loading1 />
85+ { changing && loadingIcon ? (
86+ < > { loadingIcon } < />
8587 ) : (
8688 < >
8789 { ! value && ! activeText && (
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const defaultProps = {
1111 disabled : false ,
1212 activeText : '' ,
1313 inactiveText : '' ,
14+ loadingIcon : < Loading1 /> ,
1415} as WebSwitchProps
1516export const Switch : FunctionComponent < Partial < WebSwitchProps > > = ( props ) => {
1617 const {
@@ -19,6 +20,7 @@ export const Switch: FunctionComponent<Partial<WebSwitchProps>> = (props) => {
1920 disabled,
2021 activeText,
2122 inactiveText,
23+ loadingIcon,
2224 className,
2325 style,
2426 onChange,
@@ -78,8 +80,8 @@ export const Switch: FunctionComponent<Partial<WebSwitchProps>> = (props) => {
7880 } ,
7981 ] ) }
8082 >
81- { changing ? (
82- < Loading1 />
83+ { changing && loadingIcon ? (
84+ < > { loadingIcon } < />
8385 ) : (
8486 < >
8587 { ! value && ! activeText && (
Original file line number Diff line number Diff line change @@ -225,6 +225,7 @@ plugins: [
225225
226226- ` activeText ` 属性类型更改为` ReactNode `
227227- ` inactiveText ` 属性类型更改为 ` ReactNode `
228+ - 新增 ` loadingIcon ` 属性,受控 loading 态图标
228229
229230[ // ] : # ' #### Toast '
230231
Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ plugins: [
228228
229229- ` activeText ` 属性类型更改为` ReactNode `
230230- ` inactiveText ` 属性类型更改为 ` ReactNode `
231+ - 新增 ` loadingIcon ` 属性,受控 loading 态图标
231232
232233[ // ] : # ' #### Toast '
233234
Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ export interface BaseSwitch extends BaseProps {
77 disabled : boolean
88 activeText : ReactNode
99 inactiveText : ReactNode
10+ loadingIcon : ReactNode
1011 onChange : ( val : boolean ) => void
1112}
You can’t perform that action at this time.
0 commit comments