primevue-mirror/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-05-20 12:14:38 +00:00
<div class="card flex flex-wrap gap-4 p-fluid">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="mile" class="font-bold block mb-2"> Mile </label>
<InputNumber v-model="value1" inputId="mile" suffix=" mi" />
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
<InputNumber v-model="value2" inputId="percent" prefix="%" />
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" />
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" />
</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: `
<InputNumber v-model="value1" inputId="mile" suffix=" mi" />
2023-02-28 08:29:30 +00:00
<InputNumber v-model="value2" inputId="percent" prefix="%" />
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" />
2023-10-15 09:38:39 +00:00
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex flex-wrap gap-4 p-fluid">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="mile" class="font-bold block mb-2"> Mile </label>
<InputNumber v-model="value1" inputId="mile" suffix=" mi" />
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
<InputNumber v-model="value2" inputId="percent" prefix="%" />
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" />
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" />
</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-05-20 12:14:38 +00:00
<div class="card flex flex-wrap gap-4 p-fluid">
2023-02-28 08:29:30 +00:00
<div class="flex-auto">
<label for="mile" class="font-bold block mb-2"> Mile </label>
<InputNumber v-model="value1" inputId="mile" suffix=" mi" />
</div>
<div class="flex-auto">
<label for="percent" class="font-bold block mb-2"> Percent </label>
<InputNumber v-model="value2" inputId="percent" prefix="%" />
</div>
<div class="flex-auto">
<label for="expiry" class="font-bold block mb-2"> Expiry </label>
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" />
</div>
<div class="flex-auto">
<label for="temperature" class="font-bold block mb-2"> Temperature </label>
<InputNumber v-model="value4" inputId="temperature" prefix="&uarr; " suffix="℃" :min="0" :max="40" />
</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>