Skip to content

Commit d8738f7

Browse files
authored
fix(progress): 移除getInnerDiameter() 并改使用heightBar (#3139)
* fix(progress): 移除getInnerDiameter() 并改使用heightBar * fix(progress): 移除getRect --------- Co-authored-by: hxh <1047739781>
1 parent a8365b0 commit d8738f7

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/progress/progress.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
22
import config from '../common/config';
33
import props from './props';
44
import { getBackgroundColor } from './utils';
5-
import { unitConvert, getRect } from '../common/utils';
5+
import { unitConvert } from '../common/utils';
66

77
const { prefix } = config;
88
const name = `${prefix}-progress`;
@@ -67,11 +67,6 @@ export default class Progress extends SuperComponent {
6767
});
6868
},
6969

70-
theme(theme) {
71-
if (theme === 'circle') {
72-
this.getInnerDiameter();
73-
}
74-
},
7570

7671
trackColor(trackColor) {
7772
this.setData({
@@ -80,17 +75,4 @@ export default class Progress extends SuperComponent {
8075
},
8176
};
8277

83-
methods = {
84-
getInnerDiameter() {
85-
const { strokeWidth } = this.properties;
86-
const wrapID = `.${name}__canvas--circle`;
87-
if (strokeWidth) {
88-
getRect(this, wrapID).then((wrapRect) => {
89-
this.setData({
90-
innerDiameter: wrapRect.width - unitConvert(strokeWidth) * 2,
91-
});
92-
});
93-
}
94-
},
95-
};
9678
}

src/progress/progress.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
>
8181
<view
8282
class="{{classPrefix}}__canvas--inner {{prefix}}-class-bar"
83-
style="{{innerDiameter? 'width:'+ innerDiameter*2 + 'rpx;' + 'height:'+ innerDiameter*2 + 'rpx;': ''}}"
83+
style="{{heightBar? '--td-progress-stroke-circle-width:' + heightBar + 'px' : ''}}"
8484
>
8585
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
8686
<template

0 commit comments

Comments
 (0)