首页 > 解决方案 > 将仪表板呈现为 htmlOutput

问题描述

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

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)

标签: rshinydashboard

解决方案


推荐阅读