我一直在开发一个开始变得相当大的 Shiny 应用程序。我已经解决了这个问题,将应用程序的不同部分放入各自文件中的模块中,然后获取文件。
问题是,当我对源文件的服务器部分(下面示例中的 events.R,eventsTabItems() 函数)进行更改时,我必须停止并启动 App i R-Studio 而不是按 F5在浏览器中。
有没有解决的办法?我是否必须将所有内容都包装为反应式函数?
代码示例:
用户界面
source("./sections/events.R")
eventsTabItemsUI(id = "events")
Run Code Online (Sandbox Code Playgroud)
服务器
source("./sections/events.R")
callModule(eventsTabItems, id = "events")
Run Code Online (Sandbox Code Playgroud)
事件
eventsTabItemsUI <- function(id) {
ns <- NS(id)
tabItem(ns(example))
}
eventsTabItems <- function(input, output, session) {
output@example <- ...
}
Run Code Online (Sandbox Code Playgroud)