vue——this.$route 与 this.$router
发布日期:2021-05-08 07:48:17 浏览次数:11 分类:原创文章

本文共 394 字,大约阅读时间需要 1 分钟。

this.$router.push
跳转到指定url路径,并想history栈中添加一个记录,点击后退会返回到上一个页面

// 字符串 this.$router.push('index') // 对象 this.$router.push({path: 'login-pw'}) // 带参数 this.$router.push({path: 'login-pw', query: {'account': this.account.account}}) // 跳转后的页面获取参数 this.account.account = this.$route.query.account
  • this.$router.replace
    跳转到指定url路径,但是history栈中不会有记录,点击返回会跳转到上上个页面

  • this.$router.go(n)
    向前或者向后跳转n个页面,n可为正整数或负整数

上一篇:null, undefined 和布尔值
下一篇:HTML 新手笔记

发表评论

最新留言

关注你微信了!
[***.104.42.241]2025年04月05日 03时46分26秒