持久化作用域(Persisted Scope)
保存文件系统和资源作用域,并在应用重新打开时恢复它们。
支持的平台
- Windows
- Linux
- macOS
设置
请安装 persistent-scope 插件。
- 在你的
Cargo.toml
文件中添加以下内容来安装插件。
[dependencies]tauri-plugin-persisted-scope = "2.0.0"# 或者使用 Git:tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
- 修改
lib.rs
来初始化插件。
fn run() { tauri::Builder::default() .plugin(tauri_plugin_persisted_scope::init()) .run(tauri::generate_context!()) .expect("error while running tauri application");}
用法
安装后,插件将自动保存和恢复文件系统和资源范围。
© 2025 Tauri Contributors. CC-BY / MIT