[英]How to write more than 1 line of text delimited by \n using show_alert()?
我最近发现有可能使用 package shinyWidgets
在 shiny 中显示甜蜜警报。
我试图在 function show_alert()
中放置超过 1 行由\n
分隔的文本,但我找不到任何方法来获得它。
这就是我所拥有的:
这就是我想要的(忽略字母或缩进的不同格式,我对有两行不同格式的行不感兴趣)。
尝试:
text = paste("This data is....", "Please, be careful with...", sep="\n")
text = paste("This data is....", "\n", "Please, be careful with...")
text = paste0("This data is....", "\n", "Please, be careful with...")
text = "This data is....\nPlease, be careful with..."
代码:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h2("Sweet Alert examples"),
actionButton(
inputId = "success",
label = "Submit type of data",
icon = icon("check")
)
)
server <- function(input, output, session) {
observeEvent(input$success, {
show_alert(
title = "Are you sure?",
text = "This data is....\nPlease, be careful with...",
type = "warning"
)
})
}
if (interactive())
shinyApp(ui, server)
有人知道如何帮助我吗?
提前致谢
我们可以使用show_alert
的html
参数:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h2("Sweet Alert examples"),
actionButton(
inputId = "success",
label = "Submit type of data",
icon = icon("check")
)
)
server <- function(input, output, session) {
observeEvent(input$success, {
show_alert(
title = "Are you sure?",
text = HTML("This data is....<br>Please, be careful with..."),
type = "warning",
html = TRUE
)
})
}
if (interactive())
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.