p-datatable primeng 不起作用,未显示

p-datatable primeng does not work, it is not shown

我正在尝试使用 primeng 数据表,我已经导入了组件,但它没有显示,也没有显示错误

在html

 <p-dataTable [value]="pessoas" scrollable="true" scrollHeight="200px" [rows]="20" virtualScroll="virtualScroll" [style]="{'margin-top':'30px'}"
                                [lazy]="true">
                                <p-header>Virtual Scrolling - 250K Rows</p-header>
                                <p-column field="codigo" header="codigo"></p-column>
                                <p-column field="nome" header="nome"></p-column>                                
                            </p-dataTable>

在组件中

   public pessoas = [
        {codigo: '01', nome: 'Pessoas 1'},
        {codigo: '02', nome: 'Pessoas 2'},
        {codigo: '03', nome: 'Pessoas 3'},
        {codigo: '04', nome: 'Pessoas 4'},
        {codigo: '05', nome: 'Pessoas 5'}
    ];

中app.modules.ts有。

import {DataTableModule} from 'primeng/components/datatable/datatable';

PrimeNG 需要知道存储的记录总数。只需将 [totalRecords]="5" 添加到您的 <p-datatable> 标签即可。

另外我觉得导入应该是这样的:

import { DataTableModule } from 'primeng/primeng';