mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-20 17:02:16 +00:00
pdfvuer resolve
This commit is contained in:
@@ -1,25 +1,39 @@
|
||||
<template>
|
||||
<div id="pdf-wrapper" :style="{ width: documentSize + '%' }">
|
||||
<!-- <pdf :src="pdfData" v-for="i in numPages" :key="i" :resize="true" :page="i" scale="page-width" style="width:100%; margin:0 auto 35px;" id="printable-file" class="pdf-file">
|
||||
<template slot="loading">
|
||||
<h1>loading content...</h1>
|
||||
</template>
|
||||
</pdf>-->
|
||||
<div
|
||||
class="absolute bottom-0 top-0 left-0 right-0 z-10 mx-auto overflow-y-auto rounded-xl md:p-5"
|
||||
:style="{ width: documentSize + '%' }"
|
||||
>
|
||||
<pdf
|
||||
:src="pdfData"
|
||||
v-for="i in numPages"
|
||||
:key="i"
|
||||
:resize="true"
|
||||
:page="i"
|
||||
scale="page-width"
|
||||
id="printable-file"
|
||||
class="mx-auto mb-6 w-full overflow-hidden md:rounded-xl md:shadow-lg"
|
||||
>
|
||||
<template slot="loading">
|
||||
<b>
|
||||
{{ $t('loading content...') }}
|
||||
</b>
|
||||
</template>
|
||||
</pdf>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//todo: resolve pdf
|
||||
|
||||
import { events } from '../../../bus'
|
||||
//import pdf from 'pdfvuer'
|
||||
import pdf from 'pdfvuer'
|
||||
|
||||
export default {
|
||||
name: 'PdfFile',
|
||||
components: {
|
||||
//pdf,
|
||||
pdf,
|
||||
},
|
||||
props: ['file'],
|
||||
props: [
|
||||
'file',
|
||||
],
|
||||
watch: {
|
||||
file() {
|
||||
this.getPdf()
|
||||
@@ -28,8 +42,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
pdfData: undefined,
|
||||
numPages: 0,
|
||||
documentSize: 50,
|
||||
numPages: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -39,9 +53,9 @@ export default {
|
||||
|
||||
let self = this
|
||||
|
||||
//self.pdfData = pdf.createLoadingTask(this.file.data.attributes.file_url);
|
||||
self.pdfData = pdf.createLoadingTask(this.file.data.attributes.file_url)
|
||||
|
||||
//self.pdfData.then(pdf => self.numPages = pdf.numPages);
|
||||
self.pdfData.then((pdf) => (self.numPages = pdf.numPages))
|
||||
},
|
||||
getDocumentSize() {
|
||||
if (window.innerWidth < 960) {
|
||||
@@ -49,7 +63,9 @@ export default {
|
||||
}
|
||||
|
||||
if (window.innerWidth > 960) {
|
||||
this.documentSize = localStorage.getItem('documentSize') ? parseInt(localStorage.getItem('documentSize')) : 50
|
||||
this.documentSize = localStorage.getItem('documentSize')
|
||||
? parseInt(localStorage.getItem('documentSize'))
|
||||
: 50
|
||||
}
|
||||
},
|
||||
zoomIn() {
|
||||
@@ -75,38 +91,4 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--<style src="pdfvuer/dist/pdfvuer.css" lang="css"></style>-->
|
||||
<style lang="scss" scoped>
|
||||
@import '../../../../sass/vuefilemanager/variables';
|
||||
|
||||
#pdf-wrapper {
|
||||
border-radius: 8px;
|
||||
overflow-y: scroll;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
padding: 40px;
|
||||
|
||||
.pdf-file {
|
||||
box-shadow: $light_mode_popup_shadow;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 960px) {
|
||||
#pdf-wrapper {
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
|
||||
.pdf-file {
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style src="pdfvuer/dist/pdfvuer.css" lang="css"></style>
|
||||
|
||||
Reference in New Issue
Block a user