如何修复rintrojs模式在本地工作,但在部署到Shinyapps.io时失败

时间:2019-09-04 12:00:42

标签: r shiny shinyapps intro.js

我有一个闪亮的应用程序,该应用程序使用“ rintrojs”包来创建指导模式,引导人们了解应用程序的功能。有许多数据步骤可链接到不同tabPanels上的元素。我找到了一种方法,可以将应用程序切换到每个数据步骤的相应tabPanels,当我在本地运行应用程序时可以使用,但是当我尝试将应用程序部署到Shinyapps.io时,此功能会失败(不生成任何警告)。 / p>

我的应用程序很复杂,因此我在下面创建了一个简单的reprex,以重新创建问题。

library(shiny)
library(rintrojs)

# Define ui logic
ui <-navbarPage(id = "intabset", 
                introjsUI(),
                tabPanel(title = "Tab1",
                         mainPanel(
                           introBox(
                             data.step = 1,
                             data.intro ="test",
                             actionButton("intro_button", "Launch introJS")),
                           introBox(
                             data.step=3,
                             data.intro="Final box back to Tab1",
                             div("Text in 1st tab")))),

                tabPanel(title = "Tab2",
                         mainPanel(
                           introBox(
                             data.step=2,
                             data.intro="Text in a different tab",
                             div("some text"))))                
)

# Define server logic 
server <- function(input, output, session) {

  ## IntroJS allow switching between tabs----
  observeEvent(input$intro_button, {
    introjs(session,
            events = list(onbeforechange = readCallback("switchTabs")))
  })

}

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

该应用程序包含2个选项卡面板,在Tab1中,动作按钮“ Launch introJS”应打开一系列3个模式弹出窗口。步骤1包含对tab1上元素的描述,步骤2显示与tab2上元素相关联的文本,最后步骤3再次链接回Tab 1上的元素。该应用程序按照本地描述运行,但是当部署到Shinyapps.io时,rintrojs模态窗口将不会加载超出数据步骤2,并且如果该模态随后关闭,则无法重新打开。

显示失败的rintrojs的应用程序的已部署版本在此处可用: https://scotland.shinyapps.io/scotpho-bug-test/

shinyapps.io日志中没有错误或有关此问题的任何有用信息。这是我的会话信息:

R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS: /opt/R/3.5.1/lib64/R/lib/libRblas.so
LAPACK: /opt/R/3.5.1/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_GB.UTF-8      
 [2] LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8       
 [4] LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8   
 [6] LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                 
 [9] LC_ADDRESS=C              
[10] LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8
[12] LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] rintrojs_0.2.2 shiny_1.3.2   

loaded via a namespace (and not attached):
[1] Rcpp_1.0.1       packrat_0.5.0   
 [3] digest_0.6.19    later_0.8.0     
 [5] bitops_1.0-6     mime_0.6        
 [7] R6_2.4.0         xtable_1.8-4    
 [9] jsonlite_1.6     magrittr_1.5    
[11] rlang_0.4.0      promises_1.0.1  
[13] tools_3.5.1      RCurl_1.95-4.12 
[15] httpuv_1.5.1     yaml_2.2.0      
[17] rsconnect_0.8.13 compiler_3.5.1  
[19] askpass_1.1      htmltools_0.3.6 
[21] openssl_1.4    

0 个答案:

没有答案