26

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 を使用しています

ご協力ありがとうございました。

4

1 に答える 1