I'm a beginner and I want to display Currency sign and seperate using comma when inserting the number input at the same time. I wrote this as I understand. So far no good. Anyone knows how ? Thanks
<template>
<div id="app">
<input
type="text"
id="cost"
v-model="cost"
@input="dd"
name="cost"
class="form-control form-control-md"
placeholder="Enter cost of construction"
/>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
cost: "",
};
},
methods: {
dd() {
var number = this.cost;
new Intl.NumberFormat("en-EN", {
style: "currency",
currency: "USD",
}).format(number);
return number;
},
},
};
</script>