Using Vue.Js, when I try to run on local host, I get an error of Cannot read property 'get' of undefined
It is referring to my.get request. Any advice?
export default {
asyncData({ $axios }) {
return $axios.get('https://jsonplaceholder.typicode.com/todos/1')
.then(response => {
return { posts: response.data }
})
},
const $axios = require('axios');
before the export - Nathanael$axios
variable being undefined, you will need to call$get
instead ofget
. - Florian Pallas@nuxtjs/axios
package installed in your project and present in themodules
array in thenuxt.config.js
? - Avrahamnpm i
first? - tao