I have a button on which when I click I want it to redirect to a url that is begin passed in it.
Here is my code.
<template>
<button type="button" v-on:click="gotosite(modalDetails.final.product_url)">Buy</button>
</template>
<script>
.
..
...
.....
methods : {
gotosite(producturl){
this.window.location.href = producturl
}
</script>
<style></style>
When I click on the button it doesnot redirect me to a url.
I am thinking of making the tag look like button and use it redirect it but how to do it via button.
That maybe is because window isn't an object of this
. Try using just window.location
and it should work just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With