首页 > 编程语言 > 详细

VUE 后台返回的数据是对象,转数组

时间:2020-04-20 13:09:11      阅读:2505      评论:0      收藏:0      [点我收藏+]
  data () {
    return {
      listLoading: true,
      detailsList: {},
      list: [{}],
      detailsQuery: {
        courseId: undefined
      }
    };
  },
 methods: {
    getDetailsList () {
      debugger
      this.detailsQuery.courseId = this.id
      courseDetails(this.detailsQuery).then((response) => {
        this.detailsList = response.data
        for (const i in this.detailsList) {
          this.$set(this.list[0], i, this.detailsList[i])
        }
        console.log(this.list)
        this.listLoading = false
      }).catch((err) => {
        console.log(err);
      })
    }
  },
 

 

VUE 后台返回的数据是对象,转数组

原文:https://www.cnblogs.com/star-min/p/12736850.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!