首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Iframe在我闪亮的应用程序中无法正常工作

Iframe在我闪亮的应用程序中无法正常工作
EN

Stack Overflow用户
提问于 2021-07-29 20:56:43
回答 1查看 50关注 0票数 0

我希望嵌入的网站显示在侧边栏菜单的右侧,但嵌入的网站显示在侧边栏菜单中。当用户按下细胞培养下的控制图时,嵌入的网站应清晰地显示在右侧。这是我的问题的图片

]1

如何修复此错误?下面是我的代码:

代码语言:javascript
复制
    library(shiny)
library(shinydashboard)


ui <- 
    dashboardPage(skin="black",
                  dashboardHeader(title = "CPV Dashboard ", titleWidth = 450),
                  dashboardSidebar(
                      sidebarMenu(
                          menuItem("Tab 1", tabName = "tab 1", icon = icon("medicine"),
                                   menuItem("Cell Culture",
                                            menuItem("Control Chart",                     mainPanel(fluidRow(
                                                htmlOutput("frame")))))))


                      ),
                  
                  dashboardBody())

server = function(input, output, session){
    observe({ 
        
        test <<- paste0("https://google.com") #sample url
    })
    output$frame <- renderUI({
        input$Member
        my_test <- tags$iframe(src=test, height=800, width=800)
        print(my_test)
        my_test
    })
}
shinyApp(ui, server)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-29 21:07:11

我认为您需要在dashboardPage中使用dashBoardBody

据我所知,您当前的代码并没有做到这一点。

代码语言:javascript
复制
library(shiny)
library(shinydashboard)


ui <-
  dashboardPage(
    skin = "black",
    dashboardHeader(title = "CPV Dashboard ", titleWidth = 450),
    dashboardSidebar(sidebarMenu(
      menuItem(
        "Tab 1",
        tabName = "tab 1",
        icon = icon("medicine"),
        menuItem("Cell Culture",
                 menuItem("Control Chart"))
      )
    )),
    
    dashboardBody(mainPanel(fluidRow(htmlOutput("frame"))
  ),

))

server = function(input, output, session) {
  observe({
    test <<- paste0("https://google.com") #sample url
  })
  output$frame <- renderUI({
    input$Member
    my_test <- tags$iframe(src = test,
                           height = 800,
                           width = 800)
    print(my_test)
    my_test
  })
}
shinyApp(ui, server)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68582699

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档