Compare commits

...

2 Commits

Author SHA1 Message Date
d4d85a1f11 .go 2021-07-06 17:00:01 +08:00
f72a9aa2cb replace 跳转 2021-07-06 16:54:37 +08:00

View File

@@ -4,7 +4,8 @@
<!-- 不能用a标签 -->
<!-- <a href="/foo">到foo</a> -->
<!-- <router-link to="/foo">到foo</router-link> -->
<button @click="tiaozhuan">用js跳转</button>
<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>
@@ -13,8 +14,17 @@ export default {
methods:{
tiaozhuan(){
// js this.$router.push
// 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}})
},
back(){
// 前进或后退多少步 正数是前进 负数是后退
// 如果后退 前进 数量不够 他就不会跳转
this.$router.go(99999);
}
}
}