diff --git a/src/App.vue b/src/App.vue index 365cf03..4b1ed4b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,24 +1,28 @@ \ No newline at end of file diff --git a/src/components/Yys.vue b/src/components/Yys.vue index 5f9adb5..c0fa1f7 100644 --- a/src/components/Yys.vue +++ b/src/components/Yys.vue @@ -12,11 +12,7 @@ @closeProperty="closeProperty" @updateProperty="updateProperty" /> - -
- - {{ t('prepareCapture') }} -
+ @@ -125,17 +121,7 @@ - - -
- Preview -
- - - 取 消 - 下 载 - -
+ @@ -224,6 +210,7 @@ const editShikigami = (groupIndex, positionIndex) => { state.showSelectShikigami = true; state.groupIndex = groupIndex; state.positionIndex = positionIndex; + state.currentShikigami = state.groups[groupIndex].groupInfo[positionIndex]; }; const updateShikigami = (shikigami) => { @@ -274,65 +261,11 @@ const addGroupElement = (groupIndex) => { state.groups[groupIndex].groupInfo.push({}); }; -const ignoreElements = (element) => { - return element.classList.contains('ql-toolbar'); -} -const prepareCapture = async () => { - state.previewVisible = true; // 显示预览弹窗 - - // 创建临时样式 - const style = document.createElement('style') - style.id = 'capture-style' - style.textContent = ` - .ql-container.ql-snow { - border: none !important; - } - ` - document.head.appendChild(style) - // 捕获页面元素并生成图片 - try { - const element = document.querySelector('#main-container'); // 替换为要捕获的元素选择器 - if (!element) { - console.error('Element with ID "main-container" not found.'); - state.previewVisible = false; - return; - } - - const canvas = await html2canvas(element, { - ignoreElements: ignoreElements, - height: element.scrollHeight, - } - ); - state.previewImage = canvas.toDataURL(); - if (!state.previewImage) { - console.error('Failed to generate image data URL.'); - state.previewVisible = false; - state.previewVisible = false; - } - } catch (error) { - console.error('Failed to capture screenshot', error); - state.previewVisible = false; - }finally { - // 清除临时样式 - document.getElementById('capture-style')?.remove() - } -}; -const downloadImage = () => { - if (state.previewImage) { - const link = document.createElement('a'); - link.href = state.previewImage; - link.download = 'screenshot.png'; // 设置下载的文件名 - link.click(); - state.previewVisible = false; // 关闭预览弹窗 - } -}; -const handleClose = (done) => { - state.previewImage = null; // 清除预览图像 - done(); // 关闭弹窗 -}; + +