判断是否是视频还是图片

 当发请求后拿到数据需要对数据进行处理,判断是视频就显示视频,图片显示图片





 handleIndustryList() {
      let params = {
        currentPage: this.currentPage,
        pageSize: this.pageSize,
      }
      
			home.industryMore(params).then(res=>{
        this.planList = res.data.records
        this.planList.forEach((item)=>{
          if (!item.industryVideos) return
          const videoExtensions = ['.mp4', '.avi', '.mov'];          
          let arr =  item.industryVideos.substring( item.industryVideos.lastIndexOf('.'));
          item.isVideoImg =  videoExtensions.includes(arr)
          return item
        })      
			})
    },

你可能感兴趣的:(前端,linux,javascript)