首页 > 解决方案 > 如何让 includeHTML 在多个 TabPanel 中工作?

问题描述

我正在尝试在 Shiny 应用程序的不同 tabPanel 分隔中包含 2 个 HTML 文件。我这样做了,其中一个 html 文件正确呈现,但另一个小部件不显示。有谁知道为什么?我在下面发布了应用程序代码。

library(shiny)

ui <- navbarPage(div(img(src = "bookofnumberslogo.jpg", height = 50, width = 50) ,"OSC Elections"),
                 windowTitle = "OSC Elections",
    tabPanel(
        title = "House Forecast",
        mainPanel(
            h1("House of Representatives Forecast"),
            p("This forecast is updated daily in accordance with the latest polling data."),
            p("Last Updated: ", date()),
            p("Email oscelections@gmail.com or find us on Twitter at @OSCElections if you have any questions."),
            includeHTML("elexsimGS.html")
    )),
    tabPanel(
        title = "MA Senate Democratic Primary",
        mainPanel(
            h1("Massachusetts Senate Election Democratic Primary Forecast"),
            p("This forecast estimate has last been updated on: ", date()),
            p("Email oscelections@gmail.com or find us on Twitter at @OSCElections if you have any questions."),
        includeHTML("MA-Senate-Model.html")
        ))
    )

server <- function(input, output) {
    
}

# Run the application 
shinyApp(ui = ui, server = server)

MA 参议院 Model.html 链接 elexsimGS.html 链接

标签: htmlrshinyleaflet

解决方案


推荐阅读