screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.22/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Js Remove Leading Zero from Number</h3> <input type="text" v-model="myNumber" @input="removeLeadingZero" /> <small>Number:{{result}}</small> </div> <script type="module"> const app = Vue.createApp({ data() { return { myNumber: "000345", result: '' }; }, methods: { removeLeadingZero() { this.result = Number(this.myNumber).toString(); } }, mounted() { this.removeLeadingZero() }, }) app.mount('#app') </script> <style scoped> #app { background-color: #f2f2f2; padding: 20px; } h3 { font-size: 24px; margin-bottom: 10px; } input[type="text"] { border: 1px solid #ccc; padding: 8px; font-size: 16px; } small { display: block; margin-top: 10px; font-size: 16px; } </style> </body> </html>