feat: markdown移动端兼容

This commit is contained in:
Gsh
2026-01-04 00:32:01 +08:00
parent accbaf3ecb
commit a437d55f9f
4 changed files with 43 additions and 1 deletions

View File

@@ -47,6 +47,44 @@ async function handleDownload() {
window.open(props.task.storeUrl, '_blank');
}
}
// 下载方案2
/* async function handleDownload() {
if (!props.task.storeUrl) return;
// 显示操作选项
const userChoice = confirm(
'由于浏览器安全限制,图片需要手动保存。\n\n' +
'点击"确定"在新窗口打开图片,然后右键选择"另存为..."。\n' +
'点击"取消"尝试直接下载(可能不成功)。'
);
if (userChoice) {
// 用户选择手动保存
window.open(props.task.storeUrl, '_blank');
} else {
// 尝试自动下载
try {
// 创建一个临时表单提交(绕过某些限制)
const form = document.createElement('form');
form.method = 'GET';
form.action = props.task.storeUrl;
form.target = '_blank';
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
// 同时尝试a标签
const link = document.createElement('a');
link.href = props.task.storeUrl;
link.download = `image-${Date.now()}.png`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} catch (e) {
window.open(props.task.storeUrl, '_blank');
}
}
} */
</script>
<template>

View File

@@ -50,6 +50,8 @@
/* markdown 内容元素优化 */
.markdown-body {
font-size: 14px !important;
max-width: calc(100vw - 80px);
pre {
max-width: 100%;