angular - 错误类型错误:无法读取 null 的属性“querySelectorAll”和错误类型错误:无法读取 null 的属性“getElementsByTagName”
问题描述
*<div class="col-md-12" *ngIf="data_client2.length>0"> <button class="btn print" printSectionId="listVotantesPrint" ngxPrint i18n="@@downloadList"></button> '
<button class="btn csv ml-3" (click)="export('CSV', 'listVotantesPrint')"></button>
<button class="btn excel ml-3" (click)="export('xls', 'listVotantesPrint')"></button> </div>
-------------------------------------------------- ----------------------* 组件.ts
public export(type, element) {
// console.log(element);
this.exportAsConfig = {
type: type, // the type you want to download
elementIdOrContent: element, // the id of html/table element
};
我尝试通过单击按钮在 csv 和 xml 中打印,但它给了我上述错误,我不知道为什么它这样告诉我。任何人都可以帮我解决这个问题
我正在使用角度 9“ngx-export-as”:“^1.5.0”,
解决方案
仔细检查带有 id 的元素listVotantesPrint
是否为 html 表格,csv 格式仅适用于表格
推荐阅读
- python - 在 django 的 CreateView 中发布后重定向到引用者
- arrays - Vuejs 观察动态数组元素的变化
- python - 如何用 x 轴从两个数组中绘制图形将是两个数组的长度?
- heroku - 样式表 x 未加载,因为它的 MIME 类型“text/html”不是“text/css”
- javascript - 如何在节点js中定义模型,如对象
- swift - 如何从 webkit swiftUI 中的文本字段中搜索自定义文本
- android - Android 无障碍服务:打开无障碍菜单
- reactjs - 服务器响应状态为 404(未找到)问题
- pandas - 将数据集重新整形为长格式
- angular - 最初为输入提供值时,电话屏蔽不起作用