screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.26/dist/vue.global.js"></script> </head> <body> <h3>Vue Send Text in Google Translate on Click</h3> <div id="app"> <textarea v-model="inputText"></textarea> <button @click="translate">Translate</button> </div> </div> <script> const app = Vue.createApp({ data() { return { inputText: '', } }, methods: { translate() { const url = `https://translate.google.com/?sl=auto&tl=hi&text=${encodeURIComponent(this.inputText)}&op=translate`; window.open(url, '_blank'); } } }); app.mount('#app'); </script> <style scoped> #app { display: flex; flex-direction: column; align-items: center; } textarea { width: 100%; height: 200px; margin-bottom: 20px; padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 5px; } button { padding: 10px 20px; font-size: 16px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; cursor: pointer; } button:hover { background-color: #0062cc; } </style> </body> </html>