繁体   English   中英

R Shiny:当menuSubItems时,tabItem的内容不显示

[英]R Shiny: Content of tabItem not showing when there are menuSubItems

考虑以下R Shiny代码:

# ui.R

library(shiny)
library(shinydashboard)


dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("First", tabName="First"),
      menuItem("Transportation", tabName = "Transportation",  
                         menuSubItem("Air", tabName = "Air"),
                         menuSubItem("Maritime", tabName = "Maritime")))),
  dashboardBody(tabItems(tabItem(tabName = "First",
                                 headerPanel('First')),
                         tabItem(tabName = "Transportation",
                                 headerPanel('Transportation')),
                         tabItem(tabName = "Air",
                                 headerPanel('Air')),
                         tabItem(tabName = "Maritime",
                                 headerPanel('Maritime')))))

当我点击交通菜单项时,为什么我看不到headerPanel('Transportation')

这是预期的行为吗? 在相应的menuItem具有menuSubItems的情况下,是否应忽略tabItem中内容的预期行为?

我不是100%确定这是你正在寻找的,但这使得一个Transportation headerPanel显示:

menuItem("Transportation", tabName = "Transportation",  
               menuSubItem("Air", tabName = "Air"),
               menuSubItem("Maritime", tabName = "Maritime"),
               menuSubItem("Transportation", tabName = "Transportation")))),

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM