VUE 后台返回的數據是對象,轉數組


  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);
      })
    }
  },
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM