Skip to content

Commit

Permalink
fix(progress): 移除getInnerDiameter() 并改使用heightBar (#3139)
Browse files Browse the repository at this point in the history
* fix(progress): 移除getInnerDiameter() 并改使用heightBar

* fix(progress): 移除getRect

---------

Co-authored-by: hxh <1047739781>
  • Loading branch information
huxinhai authored Sep 11, 2024
1 parent a8365b0 commit d8738f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
20 changes: 1 addition & 19 deletions src/progress/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { getBackgroundColor } from './utils';
import { unitConvert, getRect } from '../common/utils';
import { unitConvert } from '../common/utils';

const { prefix } = config;
const name = `${prefix}-progress`;
Expand Down Expand Up @@ -67,11 +67,6 @@ export default class Progress extends SuperComponent {
});
},

theme(theme) {
if (theme === 'circle') {
this.getInnerDiameter();
}
},

trackColor(trackColor) {
this.setData({
Expand All @@ -80,17 +75,4 @@ export default class Progress extends SuperComponent {
},
};

methods = {
getInnerDiameter() {
const { strokeWidth } = this.properties;
const wrapID = `.${name}__canvas--circle`;
if (strokeWidth) {
getRect(this, wrapID).then((wrapRect) => {
this.setData({
innerDiameter: wrapRect.width - unitConvert(strokeWidth) * 2,
});
});
}
},
};
}
2 changes: 1 addition & 1 deletion src/progress/progress.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
>
<view
class="{{classPrefix}}__canvas--inner {{prefix}}-class-bar"
style="{{innerDiameter? 'width:'+ innerDiameter*2 + 'rpx;' + 'height:'+ innerDiameter*2 + 'rpx;': ''}}"
style="{{heightBar? '--td-progress-stroke-circle-width:' + heightBar + 'px' : ''}}"
>
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
<template
Expand Down

0 comments on commit d8738f7

Please sign in to comment.