持久范围
保存文件系统和资源范围,并在重新打开应用时恢复它们。
🌐 Save filesystem and asset scopes and restore them when the app is reopened.
🌐 Supported Platforms
This plugin requires a Rust version of at least 1.77.2
| Platform | Level | Notes |
|---|---|---|
| windows | ||
| linux | ||
| macos | ||
| android | ||
| ios |
🌐 Setup
安装 persisted-scope 插件即可开始使用。
🌐 Install the persisted-scope plugin to get started.
使用项目的包管理器添加依赖:
npm run tauri add persisted-scopeyarn run tauri add persisted-scopepnpm tauri add persisted-scopedeno task tauri add persisted-scopebun tauri add persisted-scopecargo tauri add persisted-scope-
在
src-tauri文件夹中运行以下命令,将插件添加到Cargo.toml中的项目依赖:cargo add tauri-plugin-persisted-scope -
修改
lib.rs以初始化插件:src-tauri/src/lib.rs #[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {tauri::Builder::default().plugin(tauri_plugin_persisted_scope::init()).run(tauri::generate_context!()).expect("error while running tauri application");}
🌐 Usage
设置后,插件将自动保存和恢复文件系统和资源范围。
🌐 After setup the plugin will automatically save and restore filesystem and asset scopes.
Tauri 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站