Laravel Vapor - Code sync from Shipping Portal to solve random mass downloading of 0KB pdf files when using docker

This commit is contained in:
Dillon Ngo
2024-05-26 02:44:01 +08:00
parent 35bf735db3
commit db82c8f805
@@ -11,7 +11,7 @@
<img :src="src" class="w-100" v-if="type !== 'pdf'">
<div class="btn btn-info b-rad-none pointer m-b-20" @click="openBase64NewTab()" v-show="type === 'pdf'">Open in new window</div>
<a :href="'data:application/pdf;base64,'+src" :download="file.file.filename" v-show="type === 'pdf'"><div class="btn btn-success b-rad-none pointer m-b-20">Download</div></a>
<iframe v-if="type === 'pdf'" class="pdf-display w-100 scrollable" style="height: 80vh" :src="'data:application/pdf;base64,'+src"></iframe>
<iframe v-if="type === 'pdf' && isClicked" class="pdf-display w-100 scrollable" style="height: 80vh" :src="'data:application/pdf;base64,'+src"></iframe>
</div>
</div>
</modal-component>
@@ -31,7 +31,8 @@
return {
isLoading: false,
loaded: false,
src: ''
src: '',
isClicked: false
}
},
computed: {
@@ -41,6 +42,7 @@
},
methods:{
loadFile(){
this.isClicked = true;
if(!this.loaded) {
this.isLoading = true;
let filePath = this.type === 'pdf' ? this.file.file.file_info.original.file : this.file.file.file_info[0].original.file;