Skip to content

$route.query in vue-router can't be used in vue-resource as a param #874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hpaicf opened this issue Nov 4, 2016 · 1 comment
Closed

Comments

@hpaicf
Copy link

hpaicf commented Nov 4, 2016

I use $route.query in vue-resource like this:

Vue.http.get('/someUrl', {query: $route.query});

and receive an error:

obj.hasOwnProperty is not a function

I find in vue-route , it create query by using Object.create(null) and this is a completely blank object that doesn't inherit anything from Object. not any properties or methods from Object. So it dosn't have hasOwnProperty method.

while i see in vue-resource, the 'each' function use obj.hasOwnProperty to transform the query params.

so there is a conflect when i use $route.query as a param in vue-resource $http.get, that's definitely an usual use in vue-router to get an url param object by $route.query.

maybe it can repalced by others like:

 { } or Object.create(Object.prototype)
@fnlctrl
Copy link
Member

fnlctrl commented Nov 4, 2016

Closing as it's a duplicate of #873

@fnlctrl fnlctrl closed this as completed Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants