vue.js实现跳转页面的方法:1、 使用标签【】进行跳转;2、使用【this.$router.push()】方法,只有一个参数的时候,代表跳转地址,还可以增加一个参数传值。
【相关文章推荐:
vue.js
】
vue.js实现跳转页面的方法:
点击底部书架跳转到对应的页面
'name': 'bookshelf'表示要跳转的Vue组件名称,名称是在router文件下的index.vue中进行设置。
立即学习
“
前端免费学习笔记(深入)
”;
params :{entityId: this.entityId}里面是要传递过去的参数。
在bookshelf组件接收参数
vue.js 2.0离线手册(CHM版)
vue.js 2.0中文离线手册(CHM版)
下载
除了使用标签进行跳转,还可以使用下面的方法
同样可以跳转页面,this.$router.push()方法只有一个参数的时候,代表跳转地址,还可以增加一个参数传值。
写法:
接收参数:
相关免费学习推荐:
javascript
(视频)
书 架
{
path: '/bookshelf',
name: 'bookshelf',
component: Bookshelf
},this.bookshelfId = this.$route.params.entityId;
首 页
toIndex: function(){
this.$router.push("/?entityId="+ localStorage.getItem("entityId"));
}this.$router.push({name: "deepReadingDetail", params: {'id': data.id, 'title': data.title}});this.$route.params.title