Skip to main content

Progress Bar Player

叶敏轩About 177 min

Basic

Basic progress bar playback, according to the set time smoothly change the progress bar width to achieve progress playback.

Display percentage progress

Sometimes we want to display the current percentage on the progress bar, which can be set by the progressTextPosition property:

Colors split

The color of the interval split progress bar is set according to a single field (value) in the data, and the fill color and background preview color are drawn in two colors respectively

Split color & tooltip beta

Split the color with the real-time prompt box, add a prompt box on the progress bar.

When the content data of the prompt box is changed, the width of the prompt box will change => The positioning of the prompt box will be offset, which is not perfect at present.

High performance mode

Because the split color progress bar will cause the browser to redraw when changing the progress, the method of high-performance mode is added, but this method 'sacrifices' the function of background preview color can be customized, and uses' mask' instead of background preview color

API

Props

FieldRequiredDescriptionTypeDefault
datatruedataArray[]
durationfalsethe transition time for the animation to move to the next pointnumber1000
performancefalseenabling High Performance Mode,Applies to split color progress bar onlybooleanfalse
has-real-time-tip-boxfalsedisplay tooltipbooleanfalse
progress-bac-colorfalseProgress bar background color when color splitting is not enabledstring"#ccc"
progress-fill-colorfalseprogress bar fills color when color splitting is not enabledstring"#409eff"
is-splitfalseopen the color split progress barbooleanfalse
split-configfalsesplit the progress bar configurationSplitConfig——
split-fields-intervalfalsedivision interval rangeeg: "[0,10)" => 10 < a >= 0string""
progressTextPositionfalsedisplays progress percentage textProgressTextPositionnull

Events

EventDescriptionType
handle-playWhen the animation plays, the index and data of the current point are returned periodically according to the set transition timeFunction
skip-progressReturns the index and data for the current point when the mouse clicks on the progress barFunction

Slots

Slot NameTypeDescription
controlBtn{ play: boolean, pause:boolean, replay:boolean }control buttons (Play, pause, replay)
currentTip{}tooltip content

Exposes

EventDescriptionType
initProgressBarinit the progress bar playerFunction
playcontrol progress bar player to playFunction
pausecontrol progress bar player to pauseFunction
refreshcontrol progress bar player to replayFunction

Methods

EventDescriptionType
splitFunMethodsCalculate the result of the cut interval according to the set colorFunction: (data: any,interval: string,field: string,inRangeColor: string,outRangeColor: string) => void

Types

SplitConfig

属性名DescriptionTypeDefault
splitFieldsa field used to split colorsstring""
inRangeColorthe progress bar within the set interval is filled with colorstring"blue"
outRangeColorprogress bars that are not within the set interval are filled with colorstring"red"
outRangeBacColorprogress bar background color that is not within the set intervalstring"rgba(255,0,0,0.3)"
inRangeBacColorthe progress bar background color within the set intervalstring"rgba(0,0,255,0.3)"

ProgressTextPosition

FieldDescriptionType
nullnot display progress percentage textnull
followfollowed to the left of the current progressstring
inside-leftfixed to the far left inside the progress barstring
inside-rightfixed to the far right inside the progress barstring
outside-rightfixed to the right outside the progress barstring
Last update:
Contributors: 叶敏轩