为什么我的闪亮仪表板自定义CSS无法正常工作?

问题描述 投票:0回答:1

我正在遵循以下说明:

https://rstudio.github.io/shinydashboard/appearance.html

但我收到此错误:

警告:$:$运算符中的错误对于原子向量无效55:dots_list54:标签$ section51:dashboardSidebar

这是我的代码:

library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    # Custom CSS to hide the default logout panel
    tags$head(tags$style(HTML('.shiny-server-account { display: none; }'))),

    # The dynamically-generated user panel
    uiOutput("userpanel")
  ),
  dashboardBody()
)

server <- function(input, output, session) {
  output$userpanel <- renderUI({
    # session$user is non-NULL only in authenticated sessions
    if (!is.null(session$user)) {
      sidebarUserPanel(
        span("Logged in as ", session$user),
        subtitle = a(icon("sign-out"), "Logout", href="__logout__"))
    }
  })
}

shinyApp(ui, server)

就像在说明中一样。错误在这一行

tags$head(tags$style(HTML('.shiny-server-account { display: none; }'))),

由于我将其删除,错误消失了。

我已经有类似的代码工作了很长时间,但是它突然停止了工作。非常感谢您的帮助。

r shiny shinydashboard
1个回答
0
投票

我重新安装Rstudio后,问题消失了。我不知道为什么。

© www.soinside.com 2019 - 2024. All rights reserved.