diff options
| author | Haishan <[email protected]> | 2020-06-18 20:45:43 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2020-06-18 20:45:43 +0800 |
| commit | eb28e99f2bb117db22c6cf0396d665db9fe9c3ea (patch) | |
| tree | 0fe213360889781091f2bd186cd60b30ad150296 /src/components | |
| parent | 48acdbb5bef6c40010a8402bc0eedf8486ed0935 (diff) | |
fix(config): fix mode switching
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Config.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/Config.js b/src/components/Config.js index 46c480d..56ce9f9 100644 --- a/src/components/Config.js +++ b/src/components/Config.js @@ -20,7 +20,7 @@ import TrafficChartSample from './TrafficChartSample'; import s0 from './Config.module.css'; -const { useEffect, useState, useCallback, useRef } = React; +const { useEffect, useState, useCallback, useRef, useMemo } = React; const propsList = [{ id: 0 }, { id: 1 }, { id: 2 }, { id: 3 }]; @@ -172,6 +172,11 @@ function ConfigImpl({ [apiConfig, dispatch, updateAppConfig] ); + const mode = useMemo(() => { + const m = configState.mode; + return typeof m === 'string' && m[0].toUpperCase() + m.slice(1); + }, [configState.mode]); + return ( <div> <ContentHeader title="Config" /> @@ -220,7 +225,7 @@ function ConfigImpl({ <ToggleSwitch options={optionsRule} name="mode" - value={configState.mode} + value={mode} onChange={handleInputOnChange} /> </div> |
