The axios of vue reports an error like this.

axios has been installed and
has been introduced in the entry file. I wrote the following in the component but reported this error.
at first I wrote not this.axios but axios, but this indicates that axios is not defined, but I have introduced it in the entry file, ah, later changed to the following writing method, but still reported an error this is why? Use axios

for the first time
created () {
    this.axios.get("http://api.douban.com/v2/movie/in_theaters")
      .then(function (response) {
        console.log(response)
      })
      .catch(function (response) {
        console.log(response)
      })
}
Sep.27,2021

you this.$http.get (). Then (function (res) {

}

it already says Vue.prototype.$http = axios. Why use this.axios.get?


have you introduced axios under this component? if not, have you set axios as a global variable? if not, you need to set axios as a global variable


in webpack.base.conf.js.

the entry file is introduced. You will definitely not be able to use it in other components.
if you call a method like this, you should mount the axios to the prototype of Vue.

  

have you solved the problem? I have the same problem as you.

Menu