-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from js-tool-pack/slider
feat(components/slider): 新增 键盘控制增减的功能
- Loading branch information
Showing
6 changed files
with
179 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* title: 按键操作 | ||
* description: 可以使用键盘上的上下左右箭头控制滑块的增减。 | ||
*/ | ||
|
||
import { Slider, Switch } from '@tool-pack/react-ui'; | ||
import React, { useState } from 'react'; | ||
|
||
const App: React.FC = () => { | ||
const [value, setValue] = useState(50); | ||
const [keyboard, setKeyboard] = useState(true); | ||
return ( | ||
<> | ||
keyboard: | ||
<Switch onChange={setKeyboard} checked={keyboard} size="small" /> | ||
<Slider | ||
onChange={(v) => { | ||
setValue(v); | ||
}} | ||
keyboard={keyboard} | ||
value={value} | ||
/> | ||
{value} | ||
</> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters