feat(viewer): remove native share button from share sheet (user request) — copy link only

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-28 09:08:39 +08:00
parent dc8d3ff967
commit a5d71686ff
3 changed files with 12 additions and 62 deletions
@@ -12,7 +12,6 @@
import { nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import QRCode from 'qrcode';
import { canNativeShare } from '../../support/share';
import { copyText } from '../../support/clipboard';
const props = defineProps<{
@@ -34,7 +33,6 @@ const copyState = ref<'idle' | 'copied' | 'failed'>('idle');
let copyResetTimer: ReturnType<typeof setTimeout> | undefined;
let qrAbort: { cancel: () => void } | null = null;
const showNativeShare = canNativeShare();
/** 二维码绘制(url 变化重绘;弹层打开时按可见尺寸绘制)。 */
async function drawQr(): Promise<void> {
@@ -82,14 +80,6 @@ async function onCopy(): Promise<void> {
}, 2500);
}
async function onNativeShare(): Promise<void> {
try {
await navigator.share({ title: props.title, url: props.url });
} catch {
// 取消(AbortError)或其他失败:静默——弹层仍在,复制路径可用。
}
}
function onKeydown(event: KeyboardEvent): void {
if (event.key === 'Escape') {
event.preventDefault();
@@ -145,15 +135,7 @@ onBeforeUnmount(() => {
<!-- 链接文本已按用户要求隐藏(2026-09-24)——二维码 + 复制按钮保留。 -->
<div class="share-sheet-actions">
<button
v-if="showNativeShare"
type="button"
class="share-sheet-btn is-secondary"
data-test="share-sheet-native"
@click="onNativeShare"
>
{{ t('viewer.share') }}
</button>
<!-- 系统分享按钮已按用户要求移除(2026-09-24)——仅保留复制链接。 -->
<button
type="button"
class="share-sheet-btn is-primary"
@@ -289,13 +271,6 @@ onBeforeUnmount(() => {
.share-sheet-btn.is-primary[data-state='failed'] {
background: #b54a4a;
}
.share-sheet-btn.is-secondary {
flex: 0 0 auto;
padding: 0 18px;
background: #ffffff;
border-color: var(--viewer-divider, #d7dfeb);
color: var(--viewer-text, #172033);
}
.share-sheet-btn:focus-visible {
outline: 2px solid var(--viewer-primary, #1a73e8);
outline-offset: 2px;