【发布时间】:2020-12-07 19:46:29
【问题描述】:
一旦dashboardthemes 被加载,引导通知样式似乎不再起作用(它们都显示为灰色,即默认样式)。
下面 2 个闪亮的应用程序,第一个看起来工作正常,第二个显示问题。
有人知道如何管理/解决这个问题吗?
注意:dashboardthemes 似乎对按钮有相同的影响,请参阅this SO post
require(shiny)
require(shinydashboardPlus)
require(dashboardthemes)
# APP #1: WORKING
shinyApp(
ui = fluidPage(
actionButton("show_default", "Show Default"),
actionButton("show_message", "Show Message"),
actionButton("show_warning", "Show Warning"),
actionButton("show_error", "Show Error")
),
server = function(input, output) {
observeEvent(input$show_default, {
showNotification("This is a notification.")
})
observeEvent(input$show_message, {
showNotification("This is a notification.", type = "message")
})
observeEvent(input$show_warning, {
showNotification("This is a notification.", type = "warning")
})
observeEvent(input$show_error, {
showNotification("This is a notification.", type = "error")
})
}
)
# APP #2: WITH STYLING ISSUE
shinyApp(
ui = dashboardPagePlus(
title = "hello",
header = dashboardHeaderPlus(title = "hello"),
sidebar = dashboardSidebar(),
body = dashboardBody(
shinyDashboardThemes(
theme = "grey_light"
),
fluidPage(
actionButton("show_default", "Show Default"),
actionButton("show_message", "Show Message"),
actionButton("show_warning", "Show Warning"),
actionButton("show_error", "Show Error")
)
)
),
server = function(input, output) {
observeEvent(input$show_default, {
showNotification("This is a notification.")
})
observeEvent(input$show_message, {
showNotification("This is a notification.", type = "message")
})
observeEvent(input$show_warning, {
showNotification("This is a notification.", type = "warning")
})
observeEvent(input$show_error, {
showNotification("This is a notification.", type = "error")
})
}
)
【问题讨论】:
标签: css r shiny shinydashboard