Going to a URL using VueJS
我正在尝试转到这样的URL:
1 2 3 4 5  | methods: { show (file) { this.$router.go('/file/' + file.path + '?token=' + localStorage.getItem('jwt-token')); } }  | 
我不想去部件。我只想转到以下网址:
1  | '/file/' + file.path + '?token=' + localStorage.getItem('jwt-token')  | 
但它不起作用。它正在将我重定向到主页。
我该怎么做?
如果要转到不是Vue路由器URL的URL,可以通过以下方式使用标准JavaScript:
1  | window.location.href = '/file/' + file.path + '?token=' + localStorage.getItem('jwt-token');  | 
看看这个答案。
这应该在Vue路由器2.0中工作:
1  | this.$router.push({path: '/file/' + file.path , query: {token: localStorage.getItem('jwt-token')} })  |