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 Fullscreen on click</h3> <div :class="{ fullscreen: fullscreen }"> <button @click="toggleFullscreen()">Toggle Fullscreen</button><br> <textarea ref="textarea"></textarea> </div> </div> <script type="module"> const app = Vue.createApp({ data() { return { fullscreen: false, }; }, methods: { toggleFullscreen() { this.fullscreen = !this.fullscreen; const textarea = this.$refs.textarea; if (this.fullscreen) { textarea.style.width = '100%'; textarea.style.height = '100%'; } else { textarea.style.width = 'auto'; textarea.style.height = 'auto'; } }, }, });app.mount("#app"); </script> <style scoped> body { margin: 0; padding: 0; font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5; } #app { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; } h3 { margin-top: 0; font-weight: bold; text-align: center; } button { padding: 10px 20px; font-size: 16px; font-weight: bold; background-color: #007bff; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 20px; } textarea { padding: 20px; font-size: 16px; border-radius: 4px; box-shadow: none; width: 100%; height: 300px; background-color: #fff; transition: all 0.3s ease; } .fullscreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; background-color: #000; } </style> </body> </html>