将仪表板呈现为htmlOutput

时间:2018-11-22 15:08:15

标签: r shiny dashboard

我正在尝试制作一个多页面应用程序,但是问题是我没有从应该将我重定向到应用程序页面的按钮上得到反应,这是我的代码:

library(shiny)
library(shinyjs)
library(shinythemes)
library(shinydashboard)

render_page <- function(..., f) {
  page <- f(...)
  renderUI({
    fluidPage(page, title = title)
  })
}

ui_index <- function(...) {
  basicPage(
    actionButton("go","Go to App")
  )
}

ui_app <- function(...){
  dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody()
  )
}

ui <- (htmlOutput("page"))


server <- function(input, output, session){
  output$page <- render_page(f = ui_index)

  observeEvent(input$go,{
    output$page = render_page(f = ui_app)
  })
}

shinyApp(ui = ui,server = server)

0 个答案:

没有答案