Reputation: 719
I want to pass a value parameters in my URL, my mounted is like this
mounted () {
this.$router.push({
path: '/activatewithphone',
query: { serial: this.$route.params.serial, machine: this.$route.params.machine }
})
},
My computed
computed: {
serial () {
return this.$route.query.serial
},
machine () {
return this.$route.query.machine
}
},
I get serial and machine value like this
this.serial and this.machine
The problem here is when a user visits a URL like this
example.com/activatewithphone?serial=sddsdsds&machine=sdsdsd
It redirects back to example.com/activatewithphone
Serial and machine are dynamic
When I tried to get the value of serial with this.serial and this.machine
It returned undefine
The general idea of the app is
Here is it, the user click on a link on the desktop to activate his account, the desktop app include parameters (serial and machine) to the URL and this launch a browser, the user enter form number and make payment on the web. Then I sent reference code back to the backend with the serial and machine that was sent with the URL. Is this clear now?
Upvotes: 1
Views: 268
Reputation: 46676
Alright, so it was basically a typo.
OP used this.$route.params.serial
rather than this.$route.query.serial
.
Upvotes: 1