Fxiaoke Developer Manual Fxiaoke Developer Manual
  • APL Development Manual
  • PWC Development Manual
  • OpenAPI Documentation
  • Custom Components (PC)
  • Custom Components (Mini Program)
  • Custom Plugins (PC)
  • Custom Plugins (Mini Program)
  • Third-party Integration Plugins (H5)
  • API (PC)
  • API (Mini Program)
  • Fx DevTools
Update Log
  • 简体中文
  • English
  • Custom Components (PC)
  • Custom Components (Mini Program)
  • Custom Plugins (PC)
  • Custom Plugins (Mini Program)
  • Third-party Integration Plugins (H5)
  • API (PC)
  • API (Mini Program)
  • Fx DevTools
Update Log
  • 简体中文
  • English
  • Getting Started

  • Components

    • Component Overview
    • UI Components

      • Button
      • Radio
      • Checkbox
      • Input
      • Input Number
      • Select
      • Cascader
      • Switch
      • Time Picker
      • Date Picker
      • DateTime Picker
      • Upload
      • Color Picker
      • Table
      • Tag
      • Progress
        • Tree
        • Pagination
        • Badge
        • Alert
        • Message
        • MessageBox
        • Notification
        • Dropdown
        • Steps
        • Dialog
        • Card
        • Calendar
        • Tooltip
        • Popover
        • Collapse
        • Carousel
      • Business Components

    • Examples

    • FAQ

    Table of Contents

    Progress Bar

    # FxProgress Progress Bar

    Displays operation progress to inform users of current status and expectations.

    # Attributes

    Parameter Description Type Optional Values Default
    percentage Percentage (required) number 0-100 0
    type Progress bar type string line/circle/dashboard line
    stroke-width Progress bar width (px) number — 6
    text-inside Display text inside progress bar (only when type=line) boolean — false
    status Current progress state string success/exception/warning —
    color Progress bar background color (overrides status color) string/function/array — ''
    width Canvas width for circular progress (only when type is circle or dashboard) number — 126
    show-text Whether to display progress text boolean — true

    # Linear Progress Bar

    The Progress component requires the percentage property, which represents the percentage value (must be between 0-100). Use the format property to customize the progress text.

    <fx-progress :percentage="percentage"></fx-progress>
    <fx-progress :percentage="100" :format="format"></fx-progress>
    <fx-progress :percentage="100" status="success"></fx-progress>
    <fx-progress :percentage="100" status="warning"></fx-progress>
    <fx-progress :percentage="50" status="exception"></fx-progress>
    
    <script>
      export default {
        data:function(){
          return {
            percentage:0
          }
        },
        methods: {
          format(percentage) {
            return percentage === 100 ? 'Full' : `${percentage}%`;
          }
        },
        mounted(){
          let delay=150;
          let timer= setInterval(()=>{
            if(this.percentage>=100){
              clearInterval(timer);
              return;
            }
            this.percentage+=0.2;
          },delay)
        }
      };
    </script>
    
    Expand Copy Copy

    # Inside Percentage Display

    Displays percentage inside the progress bar, suitable for scenarios like file uploads.

    Use stroke-width to adjust progress bar height and text-inside to place text inside the bar.

    <fx-progress :text-inside="true" :stroke-width="26" :percentage="70"></fx-progress>
    <fx-progress :text-inside="true" :stroke-width="24" :percentage="100" status="success"></fx-progress>
    <fx-progress :text-inside="true" :stroke-width="22" :percentage="80" status="warning"></fx-progress>
    <fx-progress :text-inside="true" :stroke-width="20" :percentage="50" status="exception"></fx-progress>
    
    Expand Copy Copy

    # Custom Color

    Customize progress bar color using the color property, which accepts color strings, functions, or arrays.

    <fx-progress :percentage="percentage" :color="customColor"></fx-progress>
    
    <fx-progress :percentage="percentage" :color="customColorMethod"></fx-progress>
    
    <fx-progress :percentage="percentage" :color="customColors"></fx-progress>
    <div>
      <fx-button-group>
        <fx-button icon="el-icon-minus" @click="decrease"></fx-button>
        <fx-button icon="el-icon-plus" @click="increase"></fx-button>
      </fx-button-group>
    </div>
    
    <script>
      export default {
        data() {
          return {
            percentage: 20,
            customColor: '#409eff',
            customColors: [
              {color: '#f56c6c', percentage: 20},
              {color: '#e6a23c', percentage: 40},
              {color: '#5cb87a', percentage: 60},
              {color: '#1989fa', percentage: 80},
              {color: '#6f7ad3', percentage: 100}
            ]
          };
        },
        methods: {
          customColorMethod(percentage) {
            if (percentage < 30) {
              return '#909399';
            } else if (percentage < 70) {
              return '#e6a23c';
            } else {
              return '#67c23a';
            }
          },
          increase() {
            this.percentage += 10;
            if (this.percentage > 100) {
              this.percentage = 100;
            }
          },
          decrease() {
            this.percentage -= 10;
            if (this.percentage < 0) {
              this.percentage = 0;
            }
          }
        }
      }
    </script>
    
    Expand Copy Copy

    # Circular Progress Bar

    Set type to "circle" for circular progress bars. Use width to adjust its size.

    <fx-progress type="circle" :percentage="0"></fx-progress>
    <fx-progress type="circle" :percentage="25"></fx-progress>
    <fx-progress type="circle" :percentage="100" status="success"></fx-progress>
    <fx-progress type="circle" :percentage="70" status="warning"></fx-progress>
    <fx-progress type="circle" :percentage="50" status="exception"></fx-progress>
    
    Expand Copy Copy

    # Dashboard Progress Bar

    Set type to "dashboard" for dashboard-style progress bars.

    <fx-progress type="dashboard" :percentage="percentage" :color="colors"></fx-progress>
    <div>
      <fx-button-group>
        <fx-button icon="el-icon-minus" @click="decrease"></fx-button>
        <fx-button icon="el-icon-plus" @click="increase"></fx-button>
      </fx-button-group>
    </div>
    
    <script>
      export default {
        data() {
          return {
            percentage: 10,
            colors: [
              {color: '#f56c6c', percentage: 20},
              {color: '#e6a23c', percentage: 40},
              {color: '#5cb87a', percentage: 60},
              {color: '#1989fa', percentage: 80},
              {color: '#6f7ad3', percentage: 100}
            ]
          };
        },
        methods: {
          increase() {
            this.percentage += 10;
            if (this.percentage > 100) {
              this.percentage = 100;
            }
          },
          decrease() {
            this.percentage -= 10;
            if (this.percentage < 0) {
              this.percentage = 0;
            }
          }
        }
      }
    </script>
    
    Expand Copy Copy
    Tag
    Tree

    ← Tag Tree→

    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式