加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

R flash中的页面刷新按钮

发布时间:2020-12-15 19:47:04 所属栏目:百科 来源:网络整理
导读:我尝试在链接 here之后实现页面刷新按钮.但是当我在shinyapp.io中累积部署时,它失败并要求安装我已经完成的v8.该应用程序在机器上正常工作.我用过的电路是 jsResetCode - "shinyjs.reset = function() {history.go(0)}",useShinyjs(),# Include shinyjs in t
我尝试在链接 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)

编辑:从闪亮版本0.13.0开始,可以使用Shiny的session $reload()函数刷新页面

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读