pdfvuer
pdfvuer copied to clipboard
Cannot read property 'offsetWidth' of undefined
Hi. I am getting the warnning [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'offsetWidth' of undefined"
when remove some pages with code below:
<pdf ref="pdf" :src="src" v-for="i in pagePerSheet" :key="i" :page="page + i - 1" :scale.sync="scale" :resize="true" class="page" style="width:100%;" :rotate="pagePerSheet && pagePerSheet > 1 ? 90 : 0" @numpages="v => numPages = v" >
Has someone else getting this error?
I realized that the code insidecalculateScale
depends of this.$refs.container
. In case when <pdf>
component are been destroyed the function calculateScale
will be called due watch. So if I add the code below the problem is solved:
beforeDestroy() { this.pdfViewer = null; }
How can I push this peace of code to be analized? I am new with opensource projects. I don't know the process.
You could create a Github Pull Request