screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h2>Vue js window.location.hostname Property </h2> <p>Get currnet domain name from URL in Vue.js</p> <button @click="myFunction">Get DomainName</button> <p>{{currentDomain}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ currentDomain:'', } }, methods:{ myFunction(){ this.currentDomain ='Current Doamin: '+ window.location.hostname; }, } }).mount('#app') </script> </body> </head> </html>