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%;
|
||||
|
||||
3
Yi.Ai.Vue3/types/components.d.ts
vendored
3
Yi.Ai.Vue3/types/components.d.ts
vendored
@@ -16,7 +16,6 @@ declare module 'vue' {
|
||||
DeepThinking: typeof import('./../src/components/DeepThinking/index.vue')['default']
|
||||
ElAlert: typeof import('element-plus/es')['ElAlert']
|
||||
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||
ElBadge: typeof import('element-plus/es')['ElBadge']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||
@@ -26,6 +25,8 @@ declare module 'vue' {
|
||||
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||
ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
|
||||
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||
ElDrawer: typeof import('element-plus/es')['ElDrawer']
|
||||
|
||||
1
Yi.Ai.Vue3/types/import_meta.d.ts
vendored
1
Yi.Ai.Vue3/types/import_meta.d.ts
vendored
@@ -7,6 +7,7 @@ interface ImportMetaEnv {
|
||||
readonly VITE_WEB_BASE_API: string;
|
||||
readonly VITE_API_URL: string;
|
||||
readonly VITE_FILE_UPLOAD_API: string;
|
||||
readonly VITE_BUILD_COMPRESS: string;
|
||||
readonly VITE_SSO_SEVER_URL: string;
|
||||
readonly VITE_APP_VERSION: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user