screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> </head> <body> <div id="app"> <v-app> <v-main> <v-container> <h3>Vuetify Format Numbers as (INR) Currency in Text Field</h3> <v-text-field prepend-inner-icon="mdi-currency-inr" clearable label="Amount"v-model="numberValue" @input=" formatNumber"></v-text-field> </v-container> </v-main> </v-app> </div> <script src="https://cdn.jsdelivr.net/npm/vue@2.x"></script> <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x"></script> <script> new Vue({ el: '#app', vuetify: new Vuetify(), data() { return { numberValue: '' }; }, methods: { formatNumber() { // Remove non-numeric characters and format the number with commas this.numberValue = this.numberValue.replace(/[^0-9]/g, ''); this.numberValue = new Intl.NumberFormat('en-in').format(parseInt(this.numberValue, 10)); } } }); </script> </body> </html>