fix: eoDrops变量提到volume分支外,修复编辑配方报错
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Successful in 53s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 18:17:43 +00:00
parent 74a8d9aeb6
commit 24e8aea39c

View File

@@ -777,15 +777,15 @@ function editRecipe(recipe) {
const coco = ings.find(i => i.oil === '椰子油')
if (coco) {
formCocoRow.value = { ...coco, _search: '椰子油', _open: false }
const eoDrops = ings.filter(i => i.oil && i.oil !== '椰子油').reduce((s, i) => s + (i.drops || 0), 0)
// Use stored volume if available, otherwise guess from drops
if (recipe.volume) {
formVolume.value = recipe.volume
if (recipe.volume === 'custom') {
const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0)
const totalDrops = eoDrops + coco.drops
formCustomVolume.value = Math.round(totalDrops / DROPS_PER_ML)
}
} else {
const eoDrops = ings.filter(i => i.oil && i.oil !== '椰子油').reduce((s, i) => s + (i.drops || 0), 0)
const totalDrops = eoDrops + coco.drops
const ml = totalDrops / DROPS_PER_ML
if (ml <= 2) formVolume.value = 'single'