Error message
Some checks failed
Cat or Not - frontend/inzynieria_frontend/pipeline/head There was a failure building this commit
Some checks failed
Cat or Not - frontend/inzynieria_frontend/pipeline/head There was a failure building this commit
This commit is contained in:
parent
312b6e7b80
commit
02589af438
@ -40,6 +40,9 @@
|
|||||||
@change="onFileChange"
|
@change="onFileChange"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<p v-if="showError">
|
||||||
|
Akceptowane rozszerzenia to: jpg, jpeg, png
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -65,7 +68,8 @@ export default {
|
|||||||
url: null,
|
url: null,
|
||||||
size: null,
|
size: null,
|
||||||
file: null,
|
file: null,
|
||||||
name: null
|
name: null,
|
||||||
|
showError: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -96,6 +100,11 @@ export default {
|
|||||||
document.getElementById(this.id).click()
|
document.getElementById(this.id).click()
|
||||||
},
|
},
|
||||||
getFileInfo (file) {
|
getFileInfo (file) {
|
||||||
|
const acceptedExtensions = ['jpg', 'jpeg', 'png']
|
||||||
|
const name = file.name
|
||||||
|
let extension = name.split('.')[name.split('.').length - 1]
|
||||||
|
extension = extension.toLowerCase()
|
||||||
|
if (acceptedExtensions.includes(extension)) {
|
||||||
try {
|
try {
|
||||||
this.url = URL.createObjectURL(file)
|
this.url = URL.createObjectURL(file)
|
||||||
this.name = file.name
|
this.name = file.name
|
||||||
@ -106,6 +115,9 @@ export default {
|
|||||||
this.name = null
|
this.name = null
|
||||||
this.file = null
|
this.file = null
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.showError = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user