0

是否有机会不仅在文本中使用 html,而且在按钮sendweetalert或包confirmsweetalert中使用 html shinyWidgets

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$h1("Confirm sweet alert"),
  actionButton(
    inputId = "launch1",
    label = "Confirmation"
  ),
  verbatimTextOutput(outputId = "res1"),
  tags$br(),
  actionButton(
    inputId = "launch2",
    label = "Sweetalert"
  ),
  verbatimTextOutput(outputId = "res2")
)

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

  observeEvent(input$launch1, {
    confirmSweetAlert(
      session,
      inputId = "confirm",
      btn_labels = HTML("<a href='https://google.de'>Link</a>"),
      title = "confirmation",
      html = T
    )
  })
  output$res1 <- renderPrint(input$confirm)

  observeEvent(input$launch2, {
    sendSweetAlert(
      session,
      title = "sweetalert",
      html = T,
      btn_labels = HTML("<a href='https://google.de'>Link</a>")
    )
  })
}

shinyApp(ui = ui, server = server)
4

0 回答 0