feat: markdown移动端兼容
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
/* markdown 内容元素优化 */
|
||||
.markdown-body {
|
||||
font-size: 14px !important;
|
||||
max-width: calc(100vw - 80px);
|
||||
|
||||
|
||||
pre {
|
||||
max-width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user