This commit is contained in:
2021-07-06 17:00:01 +08:00
parent f72a9aa2cb
commit d4d85a1f11

View File

@@ -5,6 +5,7 @@
<!-- <a href="/foo">到foo</a> -->
<!-- <router-link to="/foo">到foo</router-link> -->
<button @click="tiaozhuan">用js replace 跳转</button>
<button @click="back">后退一步</button>
<router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link>
</div>
</template>
@@ -15,10 +16,15 @@ export default {
// js this.$router.push
// js跳转 (*)
// 编程式导航
// this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
// 用这个跳转的时候 当前页面不能被回退 在历史记录中消失了
//
this.$router.replace({path:'/foo',query:{name:123,age:234,asda:1411}})
// this.$router.replace({path:'/foo',query:{name:123,age:234,asda:1411}})
},
back(){
// 前进或后退多少步 正数是前进 负数是后退
// 如果后退 前进 数量不够 他就不会跳转
this.$router.go(99999);
}
}
}