screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <h4>Vue.js Convert Decimal to Binary</h4> <div id="app"> <label>Enter a decimal number:</label> <input type="number" v-model="decimalNumber" @input="convertToBinary" /> <p>Binary equivalent: {{ binaryNumber }}</p> </div> <script type="module"> const app = Vue.createApp({ data() { return { decimalNumber: 11, binaryNumber: '' }; }, computed: { convertToBinary() { this.binaryNumber = this.decimalNumber.toString(2) } } }); app.mount('#app'); </script> </body> </html>