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

[Feature Request] Progress supporting customize text format #11769

Closed
imageslr opened this issue Jun 27, 2018 · 4 comments · Fixed by #11867
Closed

[Feature Request] Progress supporting customize text format #11769

imageslr opened this issue Jun 27, 2018 · 4 comments · Fixed by #11867

Comments

@imageslr
Copy link

Existing Component

Component Name

Progress

Description

当前进度条的 text 只支持显示百分比形式:75%,希望能够提供一个 format 属性,允许自定义文字格式,如:
<progress percent="75" format="$percent 折"></progress>
显示 “75折"。

format 属性还可以是回调函数的形式,其参数为当前百分比。

I hope I can customize the text format of Progress component, instead of only unique format "75%". For instance, the component provides format attribute and it can be String or Function. If it is a function, the argument will be current percent.

<progress percent="70" format="$percent 折"></progress>
and the text of the component will be 75折

@element-bot element-bot changed the title [Feature Request] Progress supporting customize text format 进度条自定义文字格式 [Feature Request] Progress supporting customize text format progress bar custom text format Jun 27, 2018
@element-bot
Copy link
Member

Translation of this issue:

Existing Component
yes

Component Name
Progress

Description
The text of the current progress bar only supports the display percentage form: 75%, it is hoped that it can provide a format attribute and allow custom text format, such as:

<progress percent= "75" format= "$percent fold" ></progress>
Show "25% off".

The format attribute can also be a form of callback function whose parameter is the current percentage.
I hope I can customize the text format of Progress component.

<progress percent= "70" format= "$percent fold" ></progress>
And the text of the component will be `75 fold.

@imageslr imageslr changed the title [Feature Request] Progress supporting customize text format progress bar custom text format [Feature Request] Progress supporting customize text format Jun 27, 2018
@upupzealot
Copy link

I would vote this request up!

@benmo1602
Copy link

动态 更新 format 会导致

You may have an infinite update loop in a component render function.

@konglingwen94
Copy link

添加format属性或者slot都可以试验一下,在项目场景中我也遇到了这个需求

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants