screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue 3 Separate Number with commas</h3> <p>Original Number: {{ number }}</p> <p>Formatted Number: {{ formattedNumber }}</p> </div> <script type="module"> const { createApp, ref, onMounted } = Vue; createApp({ setup() { const number = ref(1000000); const formattedNumber = ref(''); onMounted(() => { formatNumber(); }); const formatNumber = () => { formattedNumber.value = number.value.toLocaleString(); }; return { number, formattedNumber }; } }).mount("#app"); </script> <style scoped></style> </body> </html>