


data(){
return{
bigPicSrc: '',
imageUrlArr: [],//页面展示url数组
filesData: [],//file数组
isshowlng:true,//判断上传图片按钮是否显示
}
},
methods:{
// 文件上传接收
handleSuccess (e) {
console.log('------',e)
console.log('imgs.lenght',this.imgs.length)
var lng=6-this.imgs.length
console.log('lng',lng)
let file = e.target
for (let i = 0; i < file.files.length; i++) {
this.imageUrlArr.push(window.URL.createObjectURL(file.files.item(i)))
this.filesData.push(file.files[i])
}
console.log('this.filesData',this.filesData)
console.log('this.filesData.length',this.filesData.length)
if(this.filesData.length>=lng){
this.isshowlng=false
}else{
this.isshowlng=true
}
},
clickFile () {
const input = this.$refs.uploadInput
input.click()
},
// 删除上传的案例图
handleRemoves (index) {
console.log('删除')
this.imageUrlArr.splice(index, 1)
this.filesData.splice(index, 1)
var lng=6;//限制最多上传6张
if(this.filesData.length>=lng){
this.isshowlng=false
}else{
this.isshowlng=true
}
this.$forceUpdate()
},
// 查看大图
handleView (index) {
console.log('查看大图')
this.dialogVisible=true
this.bigPicSrc = this.imageUrlArr[index]
},
}