Currently, I am working on a Laravel Vue.js project where I am trying to implement a method to redirect to a link upon clicking a div element. The code snippet provided below showcases my approach. When the user clicks on the div, I want them to be directed to the site (www.google.com). Despite exploring various solutions from similar forum posts, I have been unsuccessful in achieving this functionality.
<template>
<div style="cursor:pointer;" @mouseover="showMe" @mouseout="hideMe" @click="goToMySite">
<h6 v-show="goTolink === false">Hover Me</h6>
<h6 v-show="goToLink === true"> Click to visit My Site </h6>
</div>
</template>
<script>
export default {
props: [],
data() {
return {
goTolink: false,
}
},
methods: {
showMe(){
this.goTolink = true
},
hideMe(){
this.goTolink = false
},
goToMySite(){
href='http://www.google.com'
}
}
}
</script>
<style>
</style>