【发布时间】:2020-03-22 07:15:58
【问题描述】:
在下面的应用程序中,只要用户既不在 tab2 也不在 tab3 中并单击刷新,页面就会转到 tab1。我们能否避免这种情况并确保页面保持在相应的标签后刷新:slight_smile:是否有可能实现请指导我。
library(shiny)
ui <- fluidPage(
tabsetPanel(
id="inTabset",
tabPanel("Tab 1",actionButton("switch_tab", "Go to the third tab")
),
tabPanel("Tab 2", "there!"),
tabPanel("Tab 3", "there!"))
)
server <- function(input, output, session) {
observeEvent(input$switch_tab, {
updateTabsetPanel(session, "inTabset",selected = "Tab 3")
})
}
shinyApp(ui = ui, server = server)
【问题讨论】: