【发布时间】:2020-10-01 08:06:35
【问题描述】:
我想在使用某种 css 样式的 R 闪亮应用程序中使用模式对话框。我可以使用没有 css 样式的模态对话框,也可以使用没有模态对话框的 css 样式。但是,如果我尝试同时运行模态对话框和 css 样式,模态对话框将不再显示。
以下代码可用于重现我的结果。我的 css 样式表完全来自 https://bootswatch.com/,它需要保存在一个名为 www 的子目录中。要查看各种结果,请评论和取消评论 theme = "bootstrap-flatly.css" 行:
shinyApp(ui=fluidPage(
theme = "bootstrap-flatly.css",
h1("Heading"),
div("Some text"),
selectInput("selectInput", "SomeInput", c(1,2,3),selected = NA, multiple = TRUE),
actionButton("print","print")
),
server <- function(input,output){
showModal(modalDialog(
title = "My message",
easyClose = FALSE,
footer = actionButton("closemodal", "OK")
))
observeEvent(
{
input$closemodal
},{
removeModal()})
observeEvent(input$print, reactiveValuesToList(input) %>% print)
}
)
谁能解释这种行为并提示我如何让 css 样式与我的模态对话框一起使用?
【问题讨论】:
标签: css r shiny modal-dialog