Skip to content

Vue.axios 的具体是怎么实现的 #7

@gzyhelloworld

Description

@gzyhelloworld

在网上看了一下Vue.axios教程,为什么this.axios.get('/api/hot')就可以获得返回,不用设置baseURL吗?

this.axios.defaults.baseURL = 'http://music.qq.com/musicbox/shop/v3/data/hit';
this.axios.get('/hit_newsong.js')
.then(function (response) {
  console.log(response);
})
.catch(function (error) {
  console.log(error);
});

没看懂axios,写了一下,可以获得返回但是提示存在跨域问题。不懂axios在这个项目怎么访问接口

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions