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 回答