我尝试对我的移动应用程序项目(nativescript-angular)使用nativescript-pdf-view插件(https://www.npmjs.com/package/nativescript-pdf-view)。 PDFView无法以某种方式呈现。
我试图从视图中硬编码URL或从事件(打字稿)中加载它
在app.module.ts中,我有这个
import { PDFView } from 'nativescript-pdf-view';
import { registerElement } from 'nativescript-angular';
registerElement('PDFView', () => PDFView);
硬编码视图中的网址
<PDFView src="http://www.orimi.com/pdf-test.pdf"></PDFView>
从事件(打字稿)中加载
component.ts
onViewAttachment() {
this.attachSrc = this.detailMessage.attachments.length > 0 ?
this.detailMessage.attachments[0] : '';
if (this.attachSrc.length > 0) {
this.displayDetail = false;
this.displayAttach = true;
} else {
this.displayDetail = true;
this.displayAttach = false;
}
}
component.html
<GridLayout *ngIf="displayAttach" rows="auto,*">
<StackLayout row="0" class="attach-header">
<Label class="fa back-icon"
text=""
(tap)="onDismissAttachment()">
</Label>
</StackLayout>
<StackLayout row="1">
<PDFView [src]="attachSrc"></PDFView>
</StackLayout>
</GridLayout>
我希望PDF能够被渲染。莫名其妙现在是空白。