vue.js - vue使用router出现访问http://localhost:8080/undefined

查看:3391
本文介绍了vue.js - vue使用router出现访问http://localhost:8080/undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

使用vue的router,跳转到一个组件的时候,会多访问一个地址,

http://localhost:8080/undefined

但是其他的router都不会
访问如下:

正常的访问是这样:

两次访问的url分别是:

http://localhost:8080/#/book/detail?bookId=337134
和
http://localhost:8080/#/search/detail?name=aaa

访问路由组件的方式是:

this.$router.push({ path: '/book/detail' ,query: {"bookId":item2.id}})
和
this.$router.push({"path": "/search/detail", query: {"name": this.word}})

解决方案

你访问了空url

这篇关于vue.js - vue使用router出现访问http://localhost:8080/undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆