简体   繁体   English

为什么我的闪亮仪表板自定义 css 不起作用?

[英]Why is my shinydashboard custom css not working?

I am following these instructions:我正在遵循以下说明:

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

But I get this error:但我得到这个错误:

Warning: Error in $: $ operator is invalid for atomic vectors
  55: dots_list
  54: tags$section
  51: dashboardSidebar

This is my code:这是我的代码:

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)

Just as in the instructions.就像在说明中一样。 The error is in this line错误在这一行

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

Because if I take that out, the error disappears.因为如果我把它拿出来,错误就会消失。

I have had code similar to this working for a long time, but it has suddenly stopped working.我有类似的代码工作了很长时间,但它突然停止工作。 Any help is much appreciated.任何帮助深表感谢。

The problem has disappeared after I reinstalled Rstudio.重新安装 Rstudio 后问题消失了。 I have no idea why.我不知道为什么。

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

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