我正在尝试使用Shinymaterial构建应用程序,并遇到可协作内容的一些问题。似乎通常的输出函数(uiOutput,plotOutput,textOutput)在可折叠主体中不起作用。这是一个例子;
library(shiny)
library(shinymaterial)
ui <- material_page(
material_row(
tags$ul(class = "collapsible",
tags$li(
div(class = "collapsible-header",
"Collapser 1"
),
div(class = "collapsible-body",
uiOutput("uiTest")
)
)
),
tags$ul(class = "collapsible",
tags$li(
div(class = "collapsible-header",
"Collapser 2"
),
div(class = "collapsible-body",
material_radio_button(input_id = "rbtn2", label = "Test button", choices = LETTERS[1:3])
)
)
)
)
)
server <- function(input, output) {
output$uiTest <- renderUI({
material_radio_button(input_id = "rbtn", label = "Test button", choices = LETTERS[1:3])
})
observeEvent(input$rbtn2,{
print(paste0("Button 2 work with value: ", input$rbtn2))
})
}
shinyApp(ui,server)
有什么方法可以使可协作元素与输出函数一起工作? (最好以某种独立且可重用的方式)