You are viewing a single comment's thread from:

RE: Vue.js实战笔记

in #starnote4 years ago
// 一个案例:文章列表到文章详情页
//注意:+ 号之间不能有空格!!它是绑定变量的,有空格的话会被加入
<router-link :to="'/article/'+post.permlink">{{ post.title }}</router-link>
//router.js
path: '/article/:permlink'
//article.vue 取值方法
let permlink = this.$route.params.permlink

// this.$route 和 this.$router 的区别
this.$route是路由参数对象,params,query都属于它
this.$router是路由导航对象,可以实现路由的跳转