0

私は自分の vue オブジェクトにこのメソッドを持っています:

  fetchStates: function () {
    this.$http.get('/api/locations/all_states').then((response) => {
      states = $.parseJSON(response.responseText).states
      this.$set('states', states)
    }).then(() => {
      $('.cs-select').trigger('chosen:updated')
    })
  },

アセットのプリコンパイル中に次のエラーが発生します。

ExecJS::ProgramError: Unexpected token: operator (>) (line: 62960, col: 69, pos: 1897152)

これがどこから来たのかを突き止めることができましたが、これ.then((response) => {を修正する方法がわかりません。ExecJS がvue-resource の promise 構文を認識していない可能性があります。どんな助けでも大歓迎です。

4

1 に答える 1

4

さて、同じ問題を抱えている人にとって、これは私の問題でした.then(function(response) {.then((response) => {

  fetchStates: function () {
    this.$http.get('/api/locations/all_states').then(function(response) {
      states = $.parseJSON(response.responseText).states
      paymentInfo.$set('states', states)
    }).then(function() {
      $('.cs-select').trigger('chosen:updated')
    })
  },
于 2016-06-22T00:18:45.557 に答える