primevue-mirror/doc/inputnumber/CurrencyDoc.vue

112 lines
4.6 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-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="currency-us" class="font-bold block mb-2"> United States </label>
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" />
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" />
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" />
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" />
</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: `
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" />
2023-02-28 08:29:30 +00:00
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" />
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" />
2023-10-15 09:38:39 +00:00
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" />
`,
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="currency-us" class="font-bold block mb-2"> United States </label>
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" />
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" />
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" />
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" />
</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-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="currency-us" class="font-bold block mb-2"> United States </label>
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" />
</div>
<div class="flex-auto">
<label for="currency-germany" class="font-bold block mb-2"> Germany </label>
<InputNumber v-model="value2" inputId="currency-germany" mode="currency" currency="EUR" locale="de-DE" />
</div>
<div class="flex-auto">
<label for="currency-india" class="font-bold block mb-2"> India </label>
<InputNumber v-model="value3" inputId="currency-india" mode="currency" currency="INR" currencyDisplay="code" locale="en-IN" />
</div>
<div class="flex-auto">
<label for="currency-japan" class="font-bold block mb-2"> Japan </label>
<InputNumber v-model="value4" inputId="currency-japan" mode="currency" currency="JPY" locale="jp-JP" />
</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>