primevue-mirror/apps/showcase/doc/inputnumber/NumeralsDoc.vue

112 lines
4.2 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>InputNumber is used as a controlled input with <i>v-model</i> property.</p>
</DocSectionText>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="integeronly" class="font-bold block mb-2"> Integer Only </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="integeronly" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="withoutgrouping" class="font-bold block mb-2"> Without Grouping </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="withoutgrouping" :useGrouping="false" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmaxfraction" class="font-bold block mb-2"> Min-Max Fraction Digits </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="minmaxfraction" :minFractionDigits="2" :maxFractionDigits="5" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmax" class="font-bold block mb-2"> Min-Max Boundaries </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="minmax" :min="0" :max="100" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value1: 42723,
value2: 58151,
value3: 2351.35,
value4: 50,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="integeronly" fluid />
<InputNumber v-model="value2" inputId="withoutgrouping" :useGrouping="false" fluid />
<InputNumber v-model="value3" inputId="minmaxfraction" :minFractionDigits="2" :maxFractionDigits="5" fluid />
<InputNumber v-model="value4" inputId="minmax" :min="0" :max="100" fluid />
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="integeronly" class="font-bold block mb-2"> Integer Only </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="integeronly" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="withoutgrouping" class="font-bold block mb-2"> Without Grouping </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="withoutgrouping" :useGrouping="false" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmaxfraction" class="font-bold block mb-2"> Min-Max Fraction Digits </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="minmaxfraction" :minFractionDigits="2" :maxFractionDigits="5" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmax" class="font-bold block mb-2"> Min-Max Boundaries </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="minmax" :min="0" :max="100" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script>
export default {
data() {
return {
value1: 42723,
value2: 58151,
value3: 2351.35,
value4: 50
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="integeronly" class="font-bold block mb-2"> Integer Only </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="integeronly" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="withoutgrouping" class="font-bold block mb-2"> Without Grouping </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="withoutgrouping" :useGrouping="false" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmaxfraction" class="font-bold block mb-2"> Min-Max Fraction Digits </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="minmaxfraction" :minFractionDigits="2" :maxFractionDigits="5" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="minmax" class="font-bold block mb-2"> Min-Max Boundaries </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="minmax" :min="0" :max="100" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
const value1 = ref(42723);
const value2 = ref(58151);
const value3 = ref(2351.35);
const value4 = ref(50);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>