fix: 不在打开卡片时自动跑html2canvas,改为保存时按需生成
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 3m19s

根本原因: html2canvas在CI headless Electron环境会无限挂起,
导致recipe-detail测试卡死。改为只在用户点"保存图片"时才生成。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 16:10:43 +00:00
parent 5ebffb8da4
commit cccf0091ba
2 changed files with 2 additions and 6 deletions

View File

@@ -829,7 +829,7 @@ onMounted(() => {
else { selectedVolume.value = 'custom'; customVolumeValue.value = Math.round(ml) }
loadBrand()
nextTick(() => generateCardImage())
// Don't auto-generate card image on mount — generate on demand when saving
})
function addIngredient() {

View File

@@ -656,12 +656,8 @@ async function openOilDetail(name) {
activeCard.value = card
selectedOilName.value = null
loadBrand()
// Pre-generate card image for instant save
// Generate image on demand when saving, not on open
oilCardImageUrl.value = null
await nextTick()
await new Promise(r => setTimeout(r, 300))
const el = document.querySelector('.oil-card-modal')
if (el) await generateImageFromRef({ value: el }, oilCardImageUrl)
} else {
activeCard.value = null
activeCardName.value = null