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

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

问题描述

shiny 应用程序中的 bsModal 窗口带有默认的 Close 按钮.有没有可以禁用的方法?我试图在 SO 上查找类似问题,但没有找到符合我要求的问题.我认为,如果用户可以使用右上角的 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天全站免登陆