pdfvuer icon indicating copy to clipboard operation
pdfvuer copied to clipboard

Cannot read property 'offsetWidth' of undefined

Open talisonfc opened this issue 5 years ago • 2 comments

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?

talisonfc avatar Feb 02 '20 02:02 talisonfc

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.

talisonfc avatar Feb 02 '20 02:02 talisonfc

You could create a Github Pull Request

artmadeit avatar Feb 11 '20 03:02 artmadeit