Angular 12.1.1 和 ngx-extended-pdf-viewer 9.0.5 在我们对 12.1.1 版本的最新更新中,我们遇到了一个问题: ngx-extended-pdf-viewer 下面是代码片段:
包.json
"dependencies": {
"@angular/animations": "12.1.1",
"@angular/common": "12.1.1",
"@angular/compiler": "12.1.1",
"@angular/core": "12.1.1",
"@angular/forms": "12.1.1",
"@angular/material": "12.1.1",
"@angular/material-moment-adapter": "12.1.1",
"@angular/platform-browser": "12.1.1",
"@angular/platform-browser-dynamic": "12.1.1",
"@angular/router": "12.1.1",
etc...
"ngx-extended-pdf-viewer": "9.0.5",
etc...
},
****Angular.json****
"sourceMap": true,
"assets": [
"src/favicon.ico",
"src/assets" ,
{
"glob": "**/*",
"input": "node_modules/ngx-extended-pdf-viewer/assets",
"output": "/assets/"
},
{
"glob": "**/*.md",
"input": "src/app/",
"output": "/assets"
} ,
{
"glob": "changelog.md",
"input": "node_modules/ngx-extended-pdf-viewer/",
"output": "/assets/changelog/"
}
**HTML**
<div class="col-12 center-alignStd" style="padding-left: 2px; padding-right: 2px;">
<ngx-extended-pdf-viewer
[base64Src]="documentUrl"
[useBrowserLocale]="useBrowserLocale"
[textLayer]="textLayer"
[logLevel]="0"
height="'60vh'">
</ngx-extended-pdf-viewer>
</div>
打字稿
ngOnInit() {
// this.data.url contains a hardcoded sample
// import { pdfBase64 } from '@shared/pdfBase64';
let vm = this;
if (this.data.TypeOfData == 'pdf')
{
vm.pdfParam = true;
vm.documentUrl = this.data.url;
} else {
this.pdfParam = false;
vm.documentUrl = this.data.url;
}
}
当我们执行代码时,没有编译或运行时错误。是否有人对如何调试此代码有任何想法。在以前的版本中,这有效。