我尝试在链接
here之后实现页面刷新按钮.但是当我在shinyapp.io中累积部署时,它失败并要求安装我已经完成的v8.该应用程序在机器上正常工作.我用过的电路是
- jsResetCode <- "shinyjs.reset = function() {history.go(0)}",useShinyjs(),# Include shinyjs in the UI
- extendShinyjs(text = jsResetCode),` # Add the js code to the page
- p(actionButton("reset_button","Reset Tool"))
服务器
- observeEvent(input$reset_button,{js$reset()})
有没有办法做没有shinejs的thios?
解决方法
为了完整,下面的代码是一个使用“刷新”按钮的工作Shiny应用程序的最小示例
- library(shiny)
- library(shinyjs)
- jscode <- "shinyjs.refresh = function() { history.go(0); }"
- ui <- fluidPage(
- useShinyjs(),extendShinyjs(text = jscode),textInput("text","Text"),actionButton("refresh","Refresh app")
- )
- server <- function(input,output,session) {
- observeEvent(input$refresh,{
- js$refresh();
- })
- }
- shinyApp(ui = ui,server = server)