【发布时间】:2018-05-14 20:43:25
【问题描述】:
过去几天我一直在尝试解决这个问题,但我只是没有找到解决方案。我有一个 Nativescript 应用程序,它加载存储在 webAPI 服务器上的文档。这些文档是很长的 html 文档。因此,我用滚动视图包装了 HtmlView 标记(在这种情况下,WebView 将不起作用,因为我需要在滚动底部放置一些按钮,以便客户签署文档)。这在 Android 上运行良好,但在 iOS 上,滚动视图不会展开以显示整个内容,直到用户旋转他们的设备。然后它将滚动并查看所有内容。
home.component.ts
import { Component, OnInit } from "@angular/core";
import { DocumentService } from "~/home/service/document.service";
import { IDocument, Document } from "~/home/service/document";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
constructor(
private service: DocumentService,) {
// Use the component constructor to inject providers.
}
private document = new Document();
private text = '';
ngOnInit() {
this.text = `<div>Retrieving Document...</div>`;
}
ngAfterViewInit(): void {
this.service.getById('WEB-0000063',3)
.then((data: IDocument) => {
if (data) {
this.document = data;
this.text = `<!DOCTYPE><html><body>${this.document.Body}</body></html>`;
}
});
}
}
home.component.html
<GridLayout class="page">
<GridLayout rows="*" cols="*" height="100%">
<ScrollView row="0" height="100%">
<StackLayout height="100%">
<HtmlView [html]="text"></HtmlView>
</StackLayout>
</ScrollView>
</GridLayout>
</GridLayout>
如果我对数据进行硬编码,它可以正常工作,但是当它从服务器返回时,它就会出现问题,但仅限于 iOS。
感谢任何帮助。
【问题讨论】:
-
您好,您找到解决方法了吗?我也遇到了同样的问题
标签: ios nativescript