- 【ng2-pdf-viewer】Cannot read prop
- vue中爆错Error in render: "TypeErro
- 微信小程序报错: Cannot read property
- Vue components Cannot read prop
- EasyUI datagrid cannot read prop
- VUE TypeError: Cannot read prop
- 2018-06-27 React Native ES6 作用域问
- vue报错TypeError: Cannot read prop
- 解决Cocos Creator的Cannot read prop
- React App 启动报错: Cannot read prop
报错场景:在boostrap modal中使用ng2-pdf-viewer
预览pdf,多次打开pdf出现报错
<ng-template #attachPreview let-modal>
<pdf-viewer
#pdfPreviwer
[src]="previewDoc.url"
[render-text]="false"
[original-size]="true"
style="display: block;width: fit-content;"
>
</pdf-viewer>
</ng-template>
解决方案:
ng2-pdf-viewer has a dependency called pdfjs-dist. You can find it in node_modules.
Open this file -> node_modules/pdfjs-dist/web/pdf_viewer.js
In pdf_viewer.js file, search for this line of code -> var elt = views[index].div; It is inside 'backtrackBeforeAllVisibleElements' function.
Change that code line to var elt = views[index-1].div; and save.
网友评论