🐛 修复分享链接打开方式
- 添加openShare方法替代直接调用window.open - 处理弹窗被浏览器阻止的情况,自动退回当前页跳转 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2116,7 +2116,7 @@
|
|||||||
<span><i class="fas fa-calendar-alt"></i> 创建 {{ formatDateTime(share.created_at) }}</span>
|
<span><i class="fas fa-calendar-alt"></i> 创建 {{ formatDateTime(share.created_at) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="share-card__actions">
|
<div class="share-card__actions">
|
||||||
<button class="btn btn-secondary" @click.stop="window.open(share.share_url, '_blank')">
|
<button class="btn btn-secondary" @click.stop="openShare(share.share_url)">
|
||||||
<i class="fas fa-external-link-alt"></i> 打开
|
<i class="fas fa-external-link-alt"></i> 打开
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary" @click.stop="copyShareLink(share.share_url)">
|
<button class="btn btn-secondary" @click.stop="copyShareLink(share.share_url)">
|
||||||
|
|||||||
@@ -2015,6 +2015,15 @@ handleDragLeave(e) {
|
|||||||
return d.toLocaleString();
|
return d.toLocaleString();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
openShare(url) {
|
||||||
|
if (!url) return;
|
||||||
|
const newWindow = window.open(url, '_blank', 'noopener');
|
||||||
|
if (!newWindow || newWindow.closed || typeof newWindow.closed === 'undefined') {
|
||||||
|
// 部分浏览器可能阻止弹窗,退回当前页跳转
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
copyShareLink(url) {
|
copyShareLink(url) {
|
||||||
// 复制分享链接到剪贴板
|
// 复制分享链接到剪贴板
|
||||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
|
|||||||
Reference in New Issue
Block a user