Element-React Progress 進度條

2020-10-16 11:26 更新

用于展示操作進度,告知用戶當前狀態(tài)和預期。

線形進度條 — 百分比外顯

Progress 組件設置percentage屬性即可,表示進度條對應的百分比,必填,必須在 0-100。

render() {
  return (
    <div>
      <Progress percentage={0} />
      <Progress percentage={70} />
      <Progress percentage={100} status="success" />
      <Progress percentage={50} status="exception" />
    </div>
  )
}

線形進度條 — 百分比內(nèi)顯

百分比不占用額外控件,適用于文件上傳等場景。

Progress 組件可通過 strokeWidth 屬性更改進度條的高度,并可通過 textInside 屬性來將進度條描述置于進度條內(nèi)部。

render() {
  return (
    <div>
      <Progress strokeWidth={18} percentage={0} textInside />
      <Progress strokeWidth={18} percentage={70} textInside />
      <Progress strokeWidth={18} percentage={100} status="success" textInside />
      <Progress strokeWidth={18} percentage={50} status="exception" textInside />
    </div>
  )
}

環(huán)形進度條

Progress 組件可通過 type 屬性來指定使用環(huán)形進度條,在環(huán)形進度條中,還可以通過 width 屬性來設置其大小。

render() {
  return (
    <div>
      <Progress type="circle" percentage={0} />
      <Progress type="circle" percentage={25} />
      <Progress type="circle" percentage={100} status="success" />
      <Progress type="circle" percentage={50} status="exception" />
    </div>
  )
}

Attributes

參數(shù) 說明 類型 可選值 默認值
percentage 百分比(必填) number 0-100 0
type 進度條類型 string line/circle line
strokeWidth 進度條的寬度,單位 px number 6
textInside 進度條顯示文字內(nèi)置在進度條內(nèi)(只在 type=line 時可用) Boolean false
status 進度條當前狀態(tài) string success/exception
width 環(huán)形進度條畫布寬度(只在 type=circle 時可用) number 126
showText 是否顯示進度條文字內(nèi)容 boolean true
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號