angular使用iframe比较诡异,直接用src标签是无效的。
//html
<iframe [src]="getUrl(detailData.id)" frameborder="0" width="100%" height="620px"></iframe>
//js
import {DomSanitizer} from "@angular/platform-browser";
getUrl(id){
return this.sanitizer.bypassSecurityTrustResourceUrl(`/share?scene=${id}`);
}
网友评论