# ProgressButton æ–‡æœ¬ä¸‹è½½æŒ‰é’®ï¼Œå¯æ˜¾ç¤ºå…·ä½“下载进度。 >  **说明:** > 该组件从API Version 10开始支æŒã€‚åŽç»ç‰ˆæœ¬å¦‚æœ‰æ–°å¢žå†…å®¹ï¼Œåˆ™é‡‡ç”¨ä¸Šè§’æ ‡å•ç‹¬æ ‡è®°è¯¥å†…å®¹çš„èµ·å§‹ç‰ˆæœ¬ã€‚ ## å¯¼å…¥æ¨¡å— ``` import { ProgressButton } from '@ohos.arkui.advanced.ProgressButton' ``` ## ProgressButton ProgressButton({progress: number, content: string, progressButtonWidth?: Length, clickCallback: () => void, enable: boolean}) **装饰器类型:**\@Component **系统能力:** SystemCapability.ArkUI.ArkUI.Full **傿•°ï¼š** | 傿•°å | 傿•°ç±»åž‹ | å¿…å¡« | 装饰器类型 | æè¿° | | -------- | -------- | -------- | -------- | -------- | | progress | number | 是 | \@Prop | 下载按钮的当å‰è¿›åº¦å€¼ã€‚ | | content | string | 是 | | 下载按钮的文本。 | | progressButtonWidth | Length | å¦ | - | 下载按钮的宽度。 | | clickCallback | void | 是 | | 下载按钮的点击回调。 | | enable | boolean | 是 | | 下载按钮是å¦å¯ä»¥ç‚¹å‡»ï¼Œ<br/>默认为true。 | ## 示例 ``` import { ProgressButton } from '@ohos.arkui.advanced.ProgressButton' @Entry @Component struct Index { @State halfProgress: number = 50 @State smallProgress: number = 8 @State bigProgress: number = 51 @State textState1: string = '下载' @State textState2: string = '下载' @State textState3: string = '下载' @State isRunning1: boolean = false @State isRunning2: boolean = false @State isRunning3: boolean = false @State enableState1: boolean = true @State enableState2: boolean = true @State enableState3: boolean = true build() { Column({space: 20}) { Text('6ã€ä¸‹è½½æŒ‰é’®ï¼š') ProgressButton({ progress: this.halfProgress, progressButtonWidth: "60", content: this.textState1, enable: this.enableState1, clickCallback: () => { if (this.textState1 && !this.isRunning1 && this.halfProgress < 100) { this.textState1 = 'ç»§ç»' } this.isRunning1 = !this.isRunning1 let timer = setInterval(() => { if (this.isRunning1) { if (this.halfProgress === 100) { } else { this.halfProgress++ if (this.halfProgress === 100) { // this.halfProgress = 0 this.textState1 = '已完æˆ' this.enableState1 = false } console.info('x progress++ = ' + this.halfProgress) } } else { console.info('x isRunning = ' + false) clearInterval(timer) } }, 100) } }) ProgressButton({ progress: this.smallProgress, progressButtonWidth: "100", content: this.textState2, enable: this.enableState2, clickCallback: () => { if (this.textState2 && !this.isRunning2 && this.smallProgress < 100) { this.textState2 = 'ç»§ç»' } this.isRunning2 = !this.isRunning2 let timer = setInterval(() => { if (this.isRunning2) { if (this.smallProgress === 100) { } else { this.smallProgress++ if (this.smallProgress === 100) { this.textState2 = '已完æˆ' this.enableState2 = false } console.info('x progress++ = ' + this.smallProgress) } } else { console.info('x isRunning = ' + false) clearInterval(timer) } }, 100) } }) ProgressButton({ progress: this.bigProgress, progressButtonWidth: '300', content: this.textState3, enable: this.enableState3, clickCallback: () => { this.isRunning3 = !this.isRunning3 if (!this.isRunning3 && this.textState3 && this.bigProgress < 100) { this.textState3 = 'ç»§ç»' } let timer = setInterval(() => { if (this.isRunning3) { if (this.bigProgress === 100) { } else { this.bigProgress++ if (this.bigProgress === 100) { this.textState3 = '已完æˆ' this.enableState3 = false } console.info('x progress++ = ' + this.bigProgress) } } else { console.info('x isRunning = ' + false) clearInterval(timer) } }, 100) } }) }.alignItems(HorizontalAlign.Center).width('100%') } } ``` 