Skip to main content

TrackBar 轨道条

例子#

基本用法#

export function App() {    return (        <Window>            <DemoLayout width="500dpx" height="25dpx">                <TrackBar                    onThumbRelease={(sender) => {                        console.log(                            `on thumb release, current value: ${sender.GetValue()}`,                        );                    }}                ></TrackBar>            </DemoLayout>        </Window>    );}

在这个例子中,我们演示了轨道条的基本用法:拖动滑块以获取对应位置的值:

track bar basic

同时控制台还有类似这样的输出:

on thumb release, current value: 0on thumb release, current value: 22on thumb release, current value: 46on thumb release, current value: 69on thumb release, current value: 75on thumb release, current value: 85on thumb release, current value: 100...

API#

export interface ITrackBarComponentProps extends IComponentProps {    onThumbRelease?: Parameters<ITrackBar['OnThumbRelease']>[0];}