[英]Iframe not working correctly in my Shiny App
我希望嵌入的网站显示在侧边栏菜单的右侧,但嵌入的网站显示在侧边栏菜单中。 当用户按下细胞培养下的控制图时,嵌入的网站应该清楚地显示在右侧。 这是我的问题的图像 ] 1
我该如何解决这个错误? 这是我的代码:
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)
我认为你需要的dashBoardBody
里面dashboardPage
。
据我所知,您当前的代码并没有这样做。
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.