我想在 modalDialog 中显示图像,但 R 不渲染。
以下代码仅显示指向 Google 徽标的链接,而不显示 Google 徽标本身:
服务器.R:
observeEvent(input$button, {
showModal(modalDialog(
title = "Title",
'<img>https://www.google.nl/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png</img>',
easyClose = TRUE,
footer = NULL
))
})
Run Code Online (Sandbox Code Playgroud)
用户界面
actionButton(inputId ="button", label = "Click me")
Run Code Online (Sandbox Code Playgroud)
observeEvent(input$button, {
showModal(modalDialog(
title = "Title",
HTML('<img src="http://www.google.nl/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">'),
easyClose = TRUE,
footer = NULL
))
})
Run Code Online (Sandbox Code Playgroud)
您的 html 中有错误。使用HTML(...)标签指定html代码,然后在<img>标签中指定来源。上面的代码对我有用。