简体   繁体   English

徽标未加载到闪亮的仪表板上

[英]Logo not loading on shiny dashboard

I am trying to use shiny for the first time to build a very simple web app.我第一次尝试使用闪亮来构建一个非常简单的网络应用程序。

I would like to add a logo on the left hand corner of my dashboard but failing to load the pic我想在仪表板的左上角添加徽标但无法加载图片

this is what I have written:这是我写的:

library(shiny)
library(shinydashboard)
shinyUI(
  dashboardPage(
    dashboardHeader(title=tags$img(src='logo.jpg')),
    dashboardSidebar(),
    dashboardBody()
  )
)

This is the structure of my folder这是我文件夹的结构

GH
-->model
---->app
------>webapp
       server.R
       ui.R
--> pictures
    logo.jpg

If I run my app I get a question mark as a placeholder of the actual picture如果我运行我的应用程序,我会得到一个问号作为实际图片的占位符

Try forcing it with addResourcePath(prefix, path) , and then use src = "prefix/logo.jpg"尝试使用addResourcePath(prefix, path)强制它,然后使用src = "prefix/logo.jpg"

library(shiny)
library(shinydashboard)

ui <- function(){
    addResourcePath("www", "www")
    tagList(
        dashboardPage(
            dashboardHeader(title = tags$img( src='www/logo.png') ),
            dashboardSidebar(),
            dashboardBody()
        )  
    )
}


server <- function(input, output) {

}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM