列表
<template>
<div>
<router-link to="/list/detail">进入详情</router-link>
</div>
</template>
<script>
export default {
data() {
return {
from:{},
canGet:true
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
if(vm.form.fullPath=='详情'){
vm.canGet=false
}
})
},
mounted () {
console.log("列表页:",this.$router)
if(this.canGet){
this.getData()
}
},
methods:{
getData(){
console.log('获取数据')
}
}
}
</script>
<style lang="scss" scoped>
</style>
详情
<template>
<div>
<router-link to="/list/">返回列表页</router-link>
</div>
</template>
<script>
export default {
mounted() {
console.log("详情页:", this.$router)
}
}
</script>
<style lang="scss" scoped>
</style>