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

feat(progress): fixed progress width not affected by copywriting #3349

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions src/progress/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@ describe('Progress', () => {
expect(getComputedStyle(circle4.element, null).width).toBe('50px');
expect(getComputedStyle(circle4.element, null).height).toBe('50px');
});

it(':fixedWidth', () => {
const wrapper = mount(() => <Progress percentage={30} fixedWidth={true} />);
const bar = wrapper.find('.t-progress__bar');
expect(getComputedStyle(bar.element, null).flexShrink).toBe('0');
});
});
});
1 change: 1 addition & 0 deletions src/progress/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ status | String | - | 进度条状态。可选项:success/error/warning/active
strokeWidth | String / Number | - | 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度 | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/progress/type.ts) | N
trackColor | String | '' | 进度条未完成部分颜色 | N
fixedWidth | Boolean | false | 固定进度条宽度,不受百分比文案影响 | N
3 changes: 3 additions & 0 deletions src/progress/progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default defineComponent({
if (props.trackColor) {
style.backgroundColor = props.trackColor;
}
if (props.fixedWidth) {
style.flexShrink = 0;
}
return style;
});

Expand Down
5 changes: 5 additions & 0 deletions src/progress/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ export default {
type: String,
default: '',
},
/** 固定导航条宽度,不受文案影响 */
fixedWidth: {
type: Boolean,
default: false,
},
};