Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

417
Views
How can I get window.location.href in Nuxtjs V3

I'm trying to let players join a game via QR Code. Since that game will be hosted on several IP's, i want to dynamically generate the URL.

This is my current workaround in my NuxtJS Vue Component:

<template>
  <input placeholder="copy browser window url into this field" v-model="fullPath" @change="generateQR">
</template>

<script setup>
  const fullPath = ref(null)
  QRCode.toDataURL(fullPath.value + ...
</script>

What I want to do is something like:

<script setup>
  // not working phantasy code
  QRCode.toDataURL(window.location.href + ...
</script>

When using useRouter() and useRoute()'s .fullPath attribute, I still only get the relative path / instead of http://10.16.1.173:3000/.


Full code on GitLab: pages/index.vue

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try to check if you are in client side before accessing to 'window' object, you can use :

if (process.client) {
      console.log(window.location.href)
}
about 4 years ago · Juan Pablo Isaza Report

0

Try to use this:

this.$route.query
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!