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

[UProgress] Percentage not calculated correctly with max value #938

Closed
maxsteinwand opened this issue Nov 10, 2023 · 0 comments · Fixed by #939
Closed

[UProgress] Percentage not calculated correctly with max value #938

maxsteinwand opened this issue Nov 10, 2023 · 0 comments · Fixed by #939
Labels
bug Something isn't working

Comments

@maxsteinwand
Copy link
Contributor

maxsteinwand commented Nov 10, 2023

Environment

  • Operating System: Linux
  • Node Version: v20.5.0
  • Nuxt Version: 3.7.4
  • CLI Version: 3.9.0
  • Nitro Version: 2.6.3
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Version

v2.10.0

Reproduction

https://stackblitz.com/edit/nuxt-ui-6jfnus?file=app.vue

Description

When using a custom max value the percentage is not calculated correctly as the the switch case checks if the value passed is bigger than 100 and not the custom set max.

Therefore when using :value=101 and :max=150 the progressbar looks fine but the Indicator will show 100%

const percent = computed(() => {
      switch (true) {
      case props.value < 0: return 0
      case props.value > 100: return 100
      default: return (props.value / realMax.value) * 100
      }
    })

Additional context

No response

Logs

No response

@maxsteinwand maxsteinwand added the bug Something isn't working label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant