Vue-Resource with Vue2.0 - Get Error
See original GitHub issueHi i’m using now Vue 2.0 with Vue-Resources, Bundler is Browserify.
I bind vue-resource in the app.js
// Adding Vue Plugins
Vue.use(VueResource)
// Vue App
new Vue({
render: h => h(App)
}).$mount('#app')
Than i use it on a compontent method
methods: {
fetchContent() {
this.$http.get('https://content.json', {
}).then(response => {
console.log(response)
}, response => {
console.log('Fetch Failed')
})
}
},
But i get Uncaught TypeError: Cannot read property 'get' of undefined
Is there a new secret to bind Plugins on the app.js file? The actual solution is, that i import vue, vue-resource in the component and Vue.use(VueResource)
. Than it works but i think that can be the right solution.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:14
- Comments:20 (2 by maintainers)
Top Results From Across the Web
Vue 2 and Vue-Resource [Cannot read property 'get' of ...
Vue1 this worked smoothly. What am I missing to get this working with Vue-2? Error: Uncaught TypeError: Cannot read property 'get' of undefined( ......
Read more >Error Tracking and Handling with Vue.js - Rollbar
The Vue global error handler assigned above to the window.onerror property gets called on all uncaught errors and catches them across the entire ......
Read more >Syntax error vueapp.js) IN I.E 11 vueJS don't work - Get Help
(Blank page) (SCRIPT1002: Syntax error vueapp.js) IN I.E 11 vueJS don't ... from "vue2-google-maps"; import VueResource from 'vue-resource'; ...
Read more >Axios catch error not show - Laracasts
I'm following this lesson https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19 Can you help me review my code and explain why it not work ?
Read more >vue-axios - npm
import Vue from 'vue' // in Vue 2 import * as Vue from 'vue' // in Vue ... console.log(response.data) }) this.axios.get(api).then((response) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
By the way, my mount is a bit different:
Would be a good bug if vue-resource doesn’t work when initialising before mount.
Same issue with webpack, no $http on this