replace 跳转

This commit is contained in:
theluyuan 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}})
}
}
}