[Vue warn]: Error in render: "TypeError: this.formData.subImages.split is not a function"

問題:

錯誤代碼:

computed:{
  //附圖輪播圖
  subImgList(){
    let imgArray = this.formData.subImages.split(',');
    imgArray.map(n => {
      this.subImg.push({
        name:'sub-img',
        url:n
      })
    })
    return this.subImg;
  },
},

解決辦法:

let imgArray = (this.formData.subImages || "").split(',');
參考文章:點擊打開鏈接
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章