Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(progress): 移除getInnerDiameter() 并改使用heightBar #3139

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading