使图像填充选项卡面板闪亮仪表板内列的高度

问题描述 投票:0回答:1

我有一个 tabPanel,我想要一个图形填充面板的整个高度(图形很高但很窄)。在图的左侧有一些文本,我希望图与 tabPanel 的右侧对齐。但是,使用下面的代码,我似乎无法让图形填充面板的整个长度,并且它不能正确自动调整屏幕尺寸。这样做的正确方法是什么?

ui <- shinydashboard::dashboardPage(
  shinydashboard::dashboardHeader(title = "title"),
  shinydashboard::dashboardSidebar(),
  shinydashboard::dashboardBody(
    shinydashboard::tabBox(
      title = "title",
      shiny::tabPanel(
        "test panel",
        column(
          width = 8,
          HTML(
          "Some text goes here with bullet points.
          <ul>
          <li>
          <b>Point one:</b> Lorem ipsum.
          </li>
          </ul>")
        ),
        column(
          width = 2,
          img(
            src ='testfig.png',
            style = 'width: 100%;'
          )
        )
      )
    )
  )
)

server <- function(input, output, session) {
}

shiny::shinyApp(ui, server)

上面的代码生成:

虽然这就是我想要的样子:

r shiny shinydashboard
1个回答
0
投票

column()
应该包裹在
fluidRow()
:

library(shiny)
library(shinydashboard)

ui <- shinydashboard::dashboardPage(
  shinydashboard::dashboardHeader(title = "title"),
  shinydashboard::dashboardSidebar(),
  shinydashboard::dashboardBody(
    shinydashboard::tabBox(
      title = "title",
      shiny::tabPanel(
        "test panel",
        fluidRow(
          column(
            width = 10,
            div("Some text goes here with bullet points.",
                tags$ul(tags$li(tags$b("Point one:"), " Lorem ipsum.")))
          ),
          column(
            width = 2,
            img(
              src ='https://www.r-project.org/logo/Rlogo.svg',
              style = 'width: 100%; float:right;'
            )
          )
        )
      )
    )
  )
)

server <- function(input, output, session) {
}

shiny::shinyApp(ui, server)
© www.soinside.com 2019 - 2024. All rights reserved.