如何在Vue.js中获取查询参数?
E.g. http://somesite.com?test=yay.
Can’t find a way to fetch or do I need to use pure JS or some library for this?
如何在Vue.js中获取查询参数?
E.g. http://somesite.com?test=yay.
Can’t find a way to fetch or do I need to use pure JS or some library for this?
截至目前,正确的方法是(我不知道为什么更改了它们):
this.$route.params.yourProperty instead of this.$route.query.yourProperty
网址:
www.example.com?name=john&lastName=doe注意:在
beforeRouteEnter函数中我们无法访问组件的属性,例如:this.propertyName。这就是为什么我将vmtonext函数传递给vm它。这是访问vue实例的推荐方式。实际上,它代表vue实例