[英]renderUI does not work with fillPage
我有以下簡單工作的閃亮應用程序:
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
實現相同的效果, 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)
}
當使用height:100%
工作時,這是一個典型的問題。 uiOutput的使用將在您周圍為renderUI
的結果添加一個div,不幸的是,該div的默認高度為0。 該固定也將這個div的高度設置為100%
。
if (interactive()) {
ui <- fillPage(
uiOutput("back",style = "height:100%;")
)
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)
}
希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.