tagList()只创建一个简单的标签列表。定义是
> tagList
function (...)
{
lst <- list(...)
class(lst) <- c("shiny.tag.list", "list")
return(lst)
}
Run Code Online (Sandbox Code Playgroud)
这是一个具有特殊类的简单列表shiny.tag.list。你在创建模块时使用它,模块的UI需要返回一个简单的页面,比如afluidPage等。如果你不想为模块创建额外的UI,你只需返回一些包裹在里面的UI元素tagList并处理模块外部的 UI。例如:
library(shiny)
moduleUI <- function(id){
ns <- NS(id)
# return a list of tags
tagList(h4("Select something"),
selectInput(ns("select"), "Select here", choices=1:10))
}
module <- function(input, output, session){}
ui <- shinyUI(
fluidPage(wellPanel(moduleUI("module"))) # wrap everything that comes from the moduleUI in a wellPanel
)
server <- shinyServer(function(input, output, session){
callModule(module, "module")
})
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8455 次 |
| 最近记录: |