[英]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.