【问题标题】:Primeng TabView add content after tabsPrimeng TabView 在标签后添加内容
【发布时间】:2021-12-02 01:02:29
【问题描述】:

我需要有 2/3 个选项卡,但最后在同一行上,我需要添加按钮、自定义组件等...

我没有找到办法,谷歌搜索时没有任何反应:-o

    <p-tabView>
        <p-tabPanel header="Header 1">
            Content 1
        </p-tabPanel>
        <p-tabPanel header="Header 2">
            Content 2
        </p-tabPanel>
        <p-tabPanel header="Header 3">
            Content 3
        </p-tabPanel>
        <!-- here start my custom html - without tabs content -->
        <p-tabPanel>
            <button></button>
            <app-my-custom-component></app-my-custom-component>
        </p-tabPanel>
    </p-tabView>

这是我需要的示例。 在同一行,我想添加自定义 html,当我点击它时,没有选项卡,但其他操作......例如对话框

【问题讨论】:

标签: html angular primeng tabview


【解决方案1】:

试试这个:


<p-tabView> 

  <p-tabPanel header="Header 1"> Content 1 </p-tabPanel>
  <p-tabPanel header="Header 2"> Content 2 </p-tabPanel>
  <p-tabPanel header="Header 3"> Content 3 </p-tabPanel>

  <!-- here start my custom html - without tabs content -->
  <p-tabPanel>
     <ng-template pTemplate="header">
        <p-button icon="pi pi-chevron-up" (click)="openPrev()">
        </p-button>
     </ng-template>
  </p-tabPanel>

  <p-tabPanel>
     <ng-template pTemplate="header">
        <app-my-custom-component></app-my-custom-component>
     </ng-template>
  </p-tabPanel> 
  
</p-tabView>

【讨论】:

  • 确实,它有效,但问题是,它选择标签并打开空内容......有一种方法可以防止标签被选中? (通过允许点击该选项卡)
  • 对不起。我尝试使用编程控制和 中的 [disabled] attibut 重新执行此操作,但没有取得任何成功的结果。我希望有人能帮助你。
猜你喜欢
  • 1970-01-01
  • 2019-07-30
  • 1970-01-01
  • 2021-03-21
  • 2018-12-10
  • 2020-11-27
  • 1970-01-01
  • 2019-06-22
  • 1970-01-01
相关资源
最近更新 更多