在无需重启服务器的情况下更改代码后,立即在浏览器中看到 R shiny UI 的变化?
Immediately seeing changes in R shiny UI, in the browser, after making changes in code without having to restart the server?
是否可以在我更改代码后看到 UI 中的更改(仅 UI 而不是服务器),而无需重新启动 server/refresh 页面?如果需要清缓存,也可以吗?
您可以使用 reactiveFileReader
定期 source
您将保存在另一个文件中的代码,并使用 renderUI()
/uiOutput
显示动态 UI:
app.R
library(shiny)
ui <- uiOutput("ui")
server <- function(input, output, session) {
ui <- reactiveFileReader(1000, session, "source.R", source)
output$ui <- renderUI(ui())
}
shinyApp(ui = ui, server = server)
source.R
fluidPage(
textInput("text", "text"),
textInput("text2", "text")
)
您仍然需要了解如何摆脱“TRUE”:
是否可以在我更改代码后看到 UI 中的更改(仅 UI 而不是服务器),而无需重新启动 server/refresh 页面?如果需要清缓存,也可以吗?
您可以使用 reactiveFileReader
定期 source
您将保存在另一个文件中的代码,并使用 renderUI()
/uiOutput
显示动态 UI:
app.R
library(shiny)
ui <- uiOutput("ui")
server <- function(input, output, session) {
ui <- reactiveFileReader(1000, session, "source.R", source)
output$ui <- renderUI(ui())
}
shinyApp(ui = ui, server = server)
source.R
fluidPage(
textInput("text", "text"),
textInput("text2", "text")
)
您仍然需要了解如何摆脱“TRUE”: