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

112 lines
4.7 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Monetary values are enabled by setting <i>mode</i> property as <i>currency</i>. In this setting, <i>currency</i> property also needs to be defined using ISO 4217 standard such as "USD" for the US dollar.</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="currency-us" class="font-bold block mb-2"> United States </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value1: 1500,
value2: 2500,
value3: 4250,
value4: 5002,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" fluid />
2023-02-28 08:29:30 +00:00
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" />
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" fluid />
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" 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="currency-us" class="font-bold block mb-2"> United States </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script>
export default {
data() {
return {
value1: 1500,
value2: 2500,
value3: 4250,
value4: 5002
};
}
};
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="currency-us" class="font-bold block mb-2"> United States </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" fluid />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
2024-07-02 10:05:17 +00:00
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" fluid />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
const value1 = ref(1500);
const value2 = ref(2500);
const value3 = ref(4250);
const value4 = ref(5002);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>