延时器跳转
setTimeout(()=> {
this.$router.replace({
path:'/page'
});
}1000);
延时器跳转
setTimeout(()=> {
this.$router.push({path:"/page"})
}1000);
跳转的方式
Jump(){
window.location.href="/#/admin"
this.$router.push("/admin")
this.$router.replace("/admin")
this.$router.push({path:"/admin"})
跳转传参的两种方式
this.$router.push({name:"two",params:{name:111}})
this.$router.push({path:"/one/two/",query:{name:222}})
}
two文件里接收id
<template>
<div>
姓名---{{id}}
</div>
</template>
<script>
export default{
data(){
return{
id:""
}
},
created(){
console.log(this.$route.params.name);
this.id = this.$route.params.name;
}
}
</script>
vue2跳转方法
于 2023-07-11 01:00:00 首次发布