我有一个工作示例应用程序.在这里,我设置了12092021.png作为背景图片. 12092021.png位于根目录的www文件夹中->一切都很完美.

library(shiny)

ui <- fluidPage(
  
  #background image
  tags$img(
    src = "12092021.png",
    style = 'position: absolute; position: absolute;
      width: 1024px; height: 768px;'
  ),
  
  tags$head(
    tags$style(HTML("
      #container > .form-group {
        height: 30px; 
        margin-bottom: 5px;
        font-size:30px
      }"))
  ),
  
  tags$style("#a {font-size:30px;}"),
  tags$style("#b {font-size:30px;}"),
  tags$style("#c {font-size:30px;}"),
  
  tags$style("#a1 {font-size:30px;height:30px;}"),
  tags$style("#b1 {font-size:30px;height:30px;}"),
  tags$style("#c1 {font-size:30px;height:30px;}"),
  
  numericInput("a1", "", value = 0, min=0, max=3, step=1, width = "100px"),
  numericInput("b1", "", value = 0, min=0, max=3, step=1, width = "100px"),
  numericInput("c1", "", value = 0, min=0, max=3, step=1, width = "100px"),
  div(id = "container",
      style="position: relative;left: 650px; top: 190px; ",
      numericInput("a", "", value = 0, min=0, max=3, step=1, width = "100px"),
      numericInput("b", "", value = 0, min=0, max=3, step=1, width = "100px"),
      numericInput("c", "", value = 0, min=0, max=3, step=1, width = "100px")
  )
)
server <- function(input, output, session) {
}
shinyApp(ui, server)

现在,我正在摆弄golem个,创建一个shiny 的应用程序包.有很多事情对我来说都是很 fresh 的.我设法让这款应用使用了run_app().

我的问题是,我必须在GOEM框架中的哪里保存www文件夹,以及显示我的背景图片的路径会是什么样子?

到目前为止,我已经将www文件夹复制到R文件夹,也复制到inst/app/文件夹.

enter image description here

推荐答案

这花了我一整天的时间,像往常一样很简单.到目前为止,我使用了以下代码:

  tags$img(
    src = "12092021.png",
    style = 'position: absolute; position: absolute;
      width: 1024px; height: 768px;'
  )

与通常在shiny 的应用程序中直接访问www文件夹中的文件的编码不同,在这个星座(GOEM框架)中,我们必须在路径中使用www:

  tags$img(
    src = "www/12092021.png",
    style = 'position: absolute; position: absolute;
      width: 1024px; height: 768px;'
  )

12092021.png人住在..inst/app/www

Html相关问答推荐

有没有可能一个按钮,有焦点,然后再次点击它清除它的焦点,只是使用css?

使用网格时图像溢出容器高度

如何在css中将包含多行文本的多个p-tag放在一起(并排)?

如何在用css使用网格视图时设置宽度?

Tailwind CSS:overflow-y Property Not Scrolling Unreliably to Bottom with top-[63px]

禁用的文本区域会丢失换行符

高度:适合-内容不拉伸以适合内部长度

carousel 的垂直滚动按钮居中

从html文件中提取元素的Python BeautifulSoup

HTML 邮箱在 Gmail 中无法正确显示

如何使用多边形制作如图所示的背景

四开:如何右对齐 PDF *和* HTML 中的文本

使单行路径的 svg 填充父级的 100% 宽度

白色栏超出页面100%的右侧

在DIV上应用梯度模糊未如预期工作

为什么 css position:fixed 不适用于对话框标签?

如何将自定义图像插入 Shiny plot header?

什么没有 margin-right 和 width:100% 溢出子元素到左边?

我正在使用 react-router-dom 并创建了一个固定的导航栏,它在每个网页上不断改变大小,我不知道为什么

自定义进度条 Html 和 CSS 布局