Laravel 5 在不丢失旧数据的情况下将阵列数据添加到vue中

Laravel 5 在不丢失旧数据的情况下将阵列数据添加到vue中,laravel-5,vuejs2,Laravel 5,Vuejs2,我正在制作vue应用程序,我想添加更多通过阵列中的laravel return获取的数据,而不会丢失旧数据 我的方法是 getData () { axios.get('get/users') .then(response => { this.queue = response.data.users }) .catch(e => { this.err

我正在制作vue应用程序,我想添加更多通过阵列中的laravel return获取的数据,而不会丢失旧数据

我的方法是

    getData () {
        axios.get('get/users')
            .then(response => {
                this.queue = response.data.users
            })
        .catch(e => {
          this.errors.push(e)
        })
    }
还有我的数据

    data: function () {
        return {
            queue: []
        }
    },
完整的脚本是

  data: function () {
        return {
            queue: []
        }
    },

  created () {
    this.getData()
  },
  methods: {


    getData () {
        axios.get('get/users')
            .then(response => {
                this.queue = response.data.users
            })
        .catch(e => {
          this.errors.push(e)
        })
    },

    decide (choice) {
      this.$refs.tinder.decide(choice)
    },

    submit (choice) {
      switch (choice) {
        case 'nope': // 左滑
          break;
        case 'like': // 右滑
          break;
        case 'super': // 上滑
          break;
      }
      if (this.queue.length < 2) {
        this.getData()
      }
    }
  }
数据:函数(){
返回{
队列:[]
}
},
创建(){
这个文件名为getData()
},
方法:{
getData(){
axios.get('get/users'))
。然后(响应=>{
this.queue=response.data.users
})
.catch(e=>{
此.errors.push(e)
})
},
决定(选择){
此.$refs.tinder.decision(选项)
},
提交(选择){
开关(选择){
案例“否”:/左滑
打破
case'like'://右滑
打破
案例“超级”:/上滑
打破
}
if(this.queue.length<2){
这个文件名为getData()
}
}
}
这里是视频链接

我想在队列剩下2个数据时触发此.getData() 在不丢失旧队列数据的情况下获取用户并将数组数据添加到队列中

您可以使用

在axios响应中

而不是

this.queue = response.data.users

在这种情况下,反应性会起作用吗?数组ref从不更改,元素被添加到数组中,因此它可能不会被检测为更改。我认为最好像
this.queue=this.queue.concat(response.data.users)那样使用它
concat
this.queue = response.data.users