【问题标题】:Rendering URL through valueBox() or renderValueBox()通过 valueBox() 或 renderValueBox() 渲染 URL
【发布时间】:2019-04-15 20:09:18
【问题描述】:

我想通过 'valueBox' 将网站呈现为超链接。下面是代码:

library(shiny)
library(shinydashboard)

ui = shinyUI(dashboardPage(
  dashboardHeader(title = "sam"),
  dashboardSidebar( ),
  dashboardBody(
           fluidRow(
      valueBox("100", subtitle = tags$p("Attendance", style = "font-size: 
200%;"),
           icon = icon("trademark"), color = "yellow", width = 4,
           href = "https://economictimes.indiatimes.com/")
    ) )))

server <- shinyServer(function(input, output) {

})

shinyApp(ui,server)

我不知道如何编写通过 valueBox() 或 renderValueBox() 呈现 URL 的代码。

截至目前,URL/网站显示在现有窗口中。我希望 URL/网站应该显示在弹出窗口中。

谁能帮我解决这个问题?

提前致谢。

【问题讨论】:

    标签: shiny shinydashboard


    【解决方案1】:

    valueBox 包装在a 标记内。在标签中,您可以设置target = "_blank" 以在新窗口或选项卡上打开链接。

    tags$a(
      href = "https://economictimes.indiatimes.com/", # Link to open
      target = "_blank", # Open in new window
      valueBox("100", subtitle = tags$p("Attendance", style = "font-size: 200%;"),
               icon = icon("trademark"), color = "yellow", width = 4)
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-15
      • 1970-01-01
      • 2019-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多