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

112 lines
4.0 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Custom texts e.g. units can be placed before or after the input section with the <i>prefix</i> and <i>suffix</i> properties.</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="mile" class="font-bold block mb-2"> Mile </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="mile" suffix=" mi" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="percent" prefix="%" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value1: 20,
value2: 50,
value3: 10,
value4: 20,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="mile" suffix=" mi" fluid />
<InputNumber v-model="value2" inputId="percent" prefix="%" fluid />
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" fluid />
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" 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="mile" class="font-bold block mb-2"> Mile </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="mile" suffix=" mi" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="percent" prefix="%" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script>
export default {
data() {
return {
value1: 20,
value2: 50,
value3: 10,
value4: 20
};
}
};
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="mile" class="font-bold block mb-2"> Mile </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="mile" suffix=" mi" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="percent" prefix="%" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
const value1 = ref(20);
const value2 = ref(50);
const value3 = ref(10);
const value4 = ref(20);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>