Skip to content

Commit

Permalink
update clipboard.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoJikun committed Mar 4, 2024
1 parent deb142a commit 2c44032
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/content/docs/zh-cn/features/clipboard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ import CommandTabs from '@components/CommandTabs.astro';
```js
import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager';

// Write content to clipboard
// 将内容写到剪贴板
await writeText('Tauri is awesome!');

// Read content from clipboard
// 从剪贴板读取内容
const content = await readText();
console.log(content);
// Prints "Tauri is awesome!" to the console
Expand All @@ -84,14 +84,14 @@ console.log(content);
```rust
use tauri_plugin_clipboard_manager::ClipboardExt;

// Write content to clipboard
// 将内容写到剪贴板
let clipboard_content = tauri_plugin_clipboard_manager::ClipKind::PlainText {
label: Some("Label".to_string()),
text: "Tauri is awesome!".to_string(),
};
app.clipboard().write(clipboard_content).unwrap();

// Read content from clipboard
// 从剪贴板读取内容
let content = app.clipboard().read();
println!("{:?}", content.unwrap());
// Prints "Tauri is awesome!" to the terminal
Expand Down

0 comments on commit 2c44032

Please sign in to comment.