想检查我们是否可以突出显示活动标签。我的意思是,当用户位于一个标签(“ agh”)中时,该标签应带有下划线。其他标签也是如此。在下面重新表达
app.R
library(shiny)
shinyApp(
navbarPage(
tags$head(
tags$style(
HTML(".tabbable > .nav > li[class=active] > a {text-decoration: underline}")
)
),
tabPanel("Tab1"),
tabPanel("Tab2"),
tabsetPanel(
tabPanel("agh",
numericInput("n", "Number to add", 5),
actionButton("add", "Add"),
verbatimTextOutput("sum", placeholder = TRUE)
),
tabPanel("dfd")
)
),
function(input, output, session) {
nums <- numeric()
c_sum <- eventReactive(input$add, {
nums <<- c(nums, input$n)
sum(nums)
})
output$sum <- renderText({
c_sum()
})
}
)
答案 0 :(得分:0)
library(shiny)
shinyApp(
fluidPage(
tags$head(
tags$style(
HTML(".tabbable > .nav > li[class=active] > a {text-decoration: underline}")
)
),
br(),
tabsetPanel(
tabPanel("agh",
numericInput("n", "Number to add", 5),
actionButton("add", "Add"),
verbatimTextOutput("sum", placeholder = TRUE)
),
tabPanel("dfd")
)
),
function(input, output, session) {
nums <- numeric()
c_sum <- eventReactive(input$add, {
nums <<- c(nums, input$n)
sum(nums)
})
output$sum <- renderText({
c_sum()
})
}
)