我有以下简单的闪亮应用程序:
if (interactive()) {
ui <- fillPage(
fillRow(
fillCol(".", style = "background-color: red;", height = "10%"),
fillCol(".", style = "background-color: blue;", height = "10%")
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
}
结果正是我想要的,但如果我尝试达到同样的效果,renderUI
我会得到一个空白页面。
我试图用下面的代码做到这一点:
if (interactive()) {
ui <- fillPage(
uiOutput("back")
)
server <- function(input, output, session) {
output$back <- renderUI({
fillRow(
fillCol(".", style = "background-color: red;", height = "10%"),
fillCol(".", style = "background-color: blue;", height = "10%")
)
})
}
shinyApp(ui, server)
}