replace 跳转

This commit is contained in:
2021-07-06 16:54:37 +08:00
parent b64bd050bd
commit f72a9aa2cb

View File

@@ -4,7 +4,7 @@
<!-- 不能用a标签 -->
<!-- <a href="/foo">到foo</a> -->
<!-- <router-link to="/foo">到foo</router-link> -->
<button @click="tiaozhuan">用js跳转</button>
<button @click="tiaozhuan">用js replace 跳转</button>
<router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link>
</div>
</template>
@@ -13,8 +13,12 @@ export default {
methods:{
tiaozhuan(){
// js this.$router.push
this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
// js跳转 (*)
// 编程式导航
// this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
// 用这个跳转的时候 当前页面不能被回退 在历史记录中消失了
//
this.$router.replace({path:'/foo',query:{name:123,age:234,asda:1411}})
}
}
}