将Base64图像数据的数组显示为图像

3
我是一个RadListView的输出,每个项目都有一个以Base64格式编码的图像,但我无法正确显示它们。
在组件循环中,我有:
let base64ImageSource = new ImageSource;
base64ImageSource = fromBase64(returned_expenses[i].receipt_data);

在模板中我有

<Image row="0" col="1" [src]="base64ImageSource" horizontalAlignment="right" width="100" height="100"  stretch="none"></Image>

并且没有图片。

我看到了下面的代码

this.imageSource = new ImageSource();
var loadedBase64 = this.imageSource.loadFromBase64(MY_BASE_64_STRING_PREVIOUSLY_SAVED);
console.log(loadedBase64);
if (loadedBase64) {
  let photo = <Image>this.photoImage.nativeElement;
  photo.imageSource = this.imageSource;
  this.photo = photo;
}

但我不知道该如何理解这行代码。
let photo = <Image>this.photoImage.nativeElement;

例如,photoImage被声明为什么?

感谢任何指导!

1个回答

2
在你的示例代码中,photoImage可能是一个元素的引用,可能使用ViewChildHTML
....
<Image #photoImage></Image>
...

TS

@ViewChild("photoImage") photoImage: ElementRef;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接