Skip to content

feat(VNumberInput): more flexible precision display #21315

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

Merged
merged 1 commit into from
May 19, 2025

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Apr 26, 2025

Description

resolves #21306

Markup:

<template>
  <v-app>
    <v-container>
      <v-card class="mx-auto pa-6 my-4" style="max-width: 1200px">
        <v-row class="mt-3">
          <v-col cols="4">
            <div class="mb-3"><small>(:precision='1')</small></div>
            <v-number-input label="Tax rate" v-model="exampleValue1" suffix="%" :precision="1" :min-fraction-digits='0' :step=".5" />
          </v-col>
          <v-col cols="4">
            <div class="mb-3"><small>(:precision='5' :min-fraction-digits='2')</small></div>
            <v-number-input v-model="exampleValue2" :precision="5" :min-fraction-digits='2' :step=".005" />
          </v-col>
          <v-col cols="4">
            <div class="mb-3"><small>(:precision='2' :min-fraction-digits='1')</small></div>
            <v-number-input v-model="exampleValue3" grouping :precision="example3_precision" :min-fraction-digits="example3_minFractionDigits" :step="1000" />
            <label>
              precision:
              <input type="number" v-model.number="example3_precision" />
            </label>
            <label>
              minFractionDigits:
              <input type="number" v-model.number="example3_minFractionDigits" />
            </label>
          </v-col>
        </v-row>
      </v-card>
    </v-container>
  </v-app>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const exampleValue1 = ref(6);
const exampleValue2 = ref(0.1);
const exampleValue3 = ref(25000);
const example3_precision = ref(2);
const example3_minFractionDigits = ref(1);
</script>

@J-Sek J-Sek self-assigned this Apr 26, 2025
@J-Sek J-Sek force-pushed the feat/vnumberinput-min-fraction-digits branch from 0f083a8 to d103f4d Compare May 18, 2025 08:34
@J-Sek J-Sek requested a review from johnleider May 18, 2025 08:34
@J-Sek
Copy link
Contributor Author

J-Sek commented May 18, 2025

Fixed dangling . when :min-fraction-digits='0'.

@johnleider johnleider added this to the v3.9.0 (Zealot) milestone May 19, 2025
@J-Sek J-Sek merged commit d5779cd into vuetifyjs:dev May 19, 2025
10 checks passed
@J-Sek J-Sek deleted the feat/vnumberinput-min-fraction-digits branch May 19, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants