From 77e05efb7d8b49ed13603a48b9b196ecf9ac6d1f Mon Sep 17 00:00:00 2001 From: HoshinoKoji Date: Wed, 5 Mar 2025 14:15:29 +0800 Subject: [PATCH] Fix null handling for checkbox answers in App.vue --- src/App.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 9861c17..df4d1be 100644 --- a/src/App.vue +++ b/src/App.vue @@ -136,8 +136,8 @@ export default { item.answerText = item.optTexts[item.answer]; item.answerValue = item.optValues[item.answer]; } else if (item.type === 'checkbox') { - item.answerText = item.answer.map(idx => item.optTexts[idx]).join(', '); - item.answerValue = item.answer.map(idx => item.optValues[idx]).join(', '); + item.answerText = item.answer? item.answer.map(idx => item.optTexts[idx]).join(', ') : null; + item.answerValue = item.answer? item.answer.map(idx => item.optValues[idx]).join(', ') : null; } if (item.type === 'scale' && item.answer !== undefined) { item.answerText = item.optTexts[item.answer]; item.answerValue = item.optValues[item.answer]; @@ -166,9 +166,9 @@ export default { title: item.title, key: item.key ? item.key : item.title, type: item.type, - answer: isProxy(item.answer) ? [...item.answer] : (item.answer || 'null'), - answerText: isProxy(item.answerText) ? [...item.answerText] : (item.answerText || 'null'), - answerValue: isProxy(item.answerValue) ? [...item.answerValue] : (item.answerValue || 'null'), + answer: isProxy(item.answer) ? [...item.answer] : (item.answer || null), + answerText: isProxy(item.answerText) ? [...item.answerText] : (item.answerText || null), + answerValue: isProxy(item.answerValue) ? [...item.answerValue] : (item.answerValue || null), refilled: item.refilled, responseTime: item.responseTime, }));