这是我的HTML代码,我json从.js文件中渲染所有数据,但得到
TypeError:无法在LayoutBuilder的LayoutBuilder.tryLayoutDocument(pdfmake.js:15088)的DocMeasure.measureNocument(pdfmake.js:15635)的DocMeasure.measureNocument(pdfmake.js:15635)的Function.keys()处的Function.keys()处将undefined或null转换为对象.layoutDocument(pdfmake.js:15076)at PdfPrinter.createPdfKitDocument(pdfmake.js:2130)at Document._createDoc(pdfmake.js:82)at Document.getDataUrl(pdfmake.js:177)at Document.open(pdfmake.js :109)at l.$ scope.openPdf(app.js:29)
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="pdfmake.js"></script>
<script type="text/javascript" src="vfs_fonts.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="raj.js"></script>
<script type="text/javascript" src="jspdf.js"></script>
</head>
<body ng-app="pdfDemo">
<div ng-controller="pdfCtrl">
<div id="pdfContent">
<table id="example-table">
<thead>
<th>firstName</th>
<th>lastName</th>
<th>Gender</th>
<th>Mobile</th>
</thead>
<tbody>
<tr ng-repeat="emp in employees">
<td>{{emp.firstName}}</td>
<td>{{emp.lastName}}</td>
<td>{{emp.gender}}</td>
<td>{{emp.mobile}}</td>
</tr>
</tbody>
</table>
</div>
<button ng-click="openPdf()">Open Pdf</button>
<button ng-click="downloadPdf()">Download Pdf</button>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) angularjs ×1