Number fields displays the value as a formatted number. It can be any local currency, decimal or percentage value. Use the Vue i18n function $n under the hood.
<template>
<va-number-field source="price" format="currency"></va-number-field>
</template>
Creates a number formatted in span:
<span>49,92 €</span>
For the targeted i18n locale, you first need to save a valid number format:
src/i18n/rules/numbers.js
export default {
en: {
currencyFormat: {
style: "currency",
currency: "USD",
},
},
tr: {
currencyFormat: {
style: "currency",
currency: "TL",
},
},
};
Check out the documentation for Vue i18n.
Property | Type | Description |
---|---|---|
source | string |
The property of the resource to fetch the value to display. Supports dot display for slot used object. |
item | null |
Overrides the default element added by VaShow . |
format | string |
The name of the number format to use. Vue i18n must be predefined in your plugin. |