【发布时间】:2016-04-28 23:39:34
【问题描述】:
我在我的 main.js 文件中的 Vue-Resource 中指定了一个根选项,但是当我发出请求时,它不使用根选项。我错过了什么?
代码如下:
main.js:
Vue.http.options.root = 'http://api.domain.com/v1/'
在组件中:
ready: function () {
console.log(this.$http.options.root) // Correctly show 'http://api.domain.com/v1/'
this.$http.get('/members/', null, { // FAILS because it tries to load /members/ in the current domain
headers: {'auth-token': 'abcde'}
}).then(function (xhr) {
// process ...
})
}
我做错了什么?
我正在使用 Vue.js v1.0.15 和 Vue-Resource v0.6.1
感谢您的帮助。
【问题讨论】:
标签: vue.js vue-resource