我正在尝试在有角度的应用程序中使用 pdfmake 在pdf中创建问答列表。我以以下方式设置“问答”部分:
{
text:
this.questionService.questions.
Questions['sub-section']
[0].questions[0].details['question-alt-
description'] + '\n', bold: true
},
{
style: 'tableExample',
table: {
style: 'table1',
widths: ['*'],
body: [
[{ text :
this.questionService.qanda.find(x => x.ActId == 647).ActVal == '' ? '\n'
: this.questionService.qanda.find(x => x.ActId == 647).ActVal === "No" ?
'Function for dependent question' : 'This should not print the
dependent question' ,
}]
]
}
},
现在,方案是,如果我为上述问题选择“否”,则应该出现一个从属问题,否则就不会出现。我尝试过的如下:
function builddependentquestion_1(data, columns) {
const body = [];
body.push([{
text : 'The question i want to print',
rowSpan: 1,
fillColor: '#ffffff',
bold: true,
border: [false, false, false, false]}
]);
return body;
}
function tabledependentquestion_1(data, columns) {
return {
table: {
body: builddependentquestion_1(data, columns)
}
};
}
我正在上述三元运算符中使用该函数,但是它失败了。任何人都可以帮忙。预先感谢。