Skip to content

Instantly share code, notes, and snippets.

@krzysztofjeziorny
Created December 4, 2019 14:57
Show Gist options
  • Save krzysztofjeziorny/db53032669259d485e5d66bbb435151b to your computer and use it in GitHub Desktop.
Save krzysztofjeziorny/db53032669259d485e5d66bbb435151b to your computer and use it in GitHub Desktop.
// Take a parameter from the URL ie. /?myparam=value
created() {
let uri = window.location.search.substring(1)
let params = new URLSearchParams(uri)
if (params.get("myparam") !== null) {
console.log(`My URL parameter: ` + params.get("myparam"))
this.something = params.get("myparam")
this.myFunction()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment