Skip to content

Commit

Permalink
fix: manual focus
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Feb 1, 2024
1 parent 3ff2eac commit 677884e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/TokutenItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function downloadImage() {
async function copyImage() {
try {
// 手动 focus
document.body.focus();
// 转换成 png
const image = img(props.data.image, { format: 'png' });
console.log(`复制图片:`, image);
Expand All @@ -55,8 +57,14 @@ async function copyImage() {
}
async function copyDescription() {
await clipboard.writeText(props.data.description);
toast.success(`复制描述成功`, {});
try {
document.body.focus();
await clipboard.writeText(props.data.description);
toast.success(`复制描述成功`, {});
} catch (error) {
console.error(error);
toast.error('复制描述失败', {});
}
}
</script>

Expand Down

0 comments on commit 677884e

Please sign in to comment.