如何将Tab标头文本换行为2行?

时间:2019-02-05 22:19:01

标签: angular primeng

我有这些标签,并且希望能够细分文本。例如,而不是显示

  

足球运动

我想这样显示两行:

  

足球

     

体育

有人知道如何做到这一点吗?

这是我的代码:

LIVE DEMO

<p-tabView>
  <p-tabPanel header="Soccer sport">
    The story begins as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. 
  </p-tabPanel>
  <p-tabPanel header="Football sport">
    Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather parallels the young Vito
    grows.
  </p-tabPanel>
</p-tabView>

1 个答案:

答案 0 :(得分:1)

在当前版本的primeng中,您似乎无法做到这一点。 使用最新版本7.0.5,您可以为标题提供模板。 您可以使用:

<p-tabView>
<p-tabPanel>
<ng-template pTemplate="header">Soccer<br>sport</ng-template>
    The story begins as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. 
</p-tabPanel>
<p-tabPanel>
<ng-template pTemplate="header">Football<br>sport</ng-template>
    Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather parallels the young Vito
    grows.
</p-tabPanel>

有关实时演示,请参见modified stackblitz

仅供参考:如果您要进行显然的更新,还需要在"@angular/cdk": "^7.3.1"中添加package.json