有没有办法在bsModal窗口上隐藏/禁用“关闭"按钮? [英] Is there a way to hide/disable the `Close` button on a `bsModal` window?

查看:398
本文介绍了有没有办法在bsModal窗口上隐藏/禁用“关闭"按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

shiny应用程序中的bsModal窗口带有默认的Close按钮.有没有可以禁用的方法?我尝试查找类似问题,但没有找到符合我要求的问题.我认为,如果用户可以使用右上角的X按钮关闭窗口,则实际上并不需要另一个Close按钮.请指教.遵循可复制的代码将生成一个示例bsModal窗口,以了解我的问题.

A bsModal window in shiny app comes with a default Close button. Is there a way that can be disabled? I tried to look up on SO for similar questions, but didn't find one matching my requirements. I think, if a user can close the window using the top right corner X button, there is not really a need for another Close button. Please advise. Following reproducible code will generate a sample bsModal window to understand my question.

library(shiny)
library(shinyBS)

if(interactive()){
  shinyApp(
    ui <- fluidPage(
      actionButton("open", "Open"), #action button to trigger the modal window.
      bsModal("id1", "Box 1", "open", size = "small",
              HTML(paste("A simple modal window."))
              )
      ),

    server <- function(input,output,session){

    }
  )
}

推荐答案

这应该做到

library(shiny)
library(shinyBS)

if(interactive()){
  shinyApp(
    ui <- fluidPage(
      actionButton("open", "Open"), #action button to trigger the modal window.
      bsModal("id1", "Box 1", "open", size = "small",
              HTML(paste("A simple modal window.")),
              tags$head(tags$style("#id1 .modal-footer{ display:none}"))
      )
    ),

    server <- function(input,output,session){

    }
  )
}

这篇关于有没有办法在bsModal窗口上隐藏/禁用“关闭"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆