18
我在我的main.js文件中的Vue-Resource中指定了一個根選項,但是當我執行請求時,它不使用根選項。我錯過了什麼?Vue資源根選項未使用?
下面的代碼:
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公司,資源V0.6.1
謝謝您的幫助。
哈哈,謝謝。我也在努力爲什麼根不工作。 – GusDeCooL