screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Textarea maxlength</h3> <textarea v-model="message" maxlength="20"></textarea> <p>{{ remainingCharacters }} characters remaining</p> </div> <script type="module"> const app = Vue.createApp({ data() { return { message: '', maxLength: 20 } }, computed: { remainingCharacters() { return this.maxLength - this.message.length } } }); app.mount('#app'); </script> <style scoped> #app { display: flex; flex-direction: column; align-items: center; } textarea { width: 300px; height: 100px; padding: 10px; border-radius: 5px; border: 1px solid #ccc; font-size: 16px; margin-bottom: 10px; } p { font-size: 14px; color: #999; } </style> </body> </html>