Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mrguseynov's avatar

vue watch array of array

Hi, I have dynamic forms in my create page

const form = useForm('post', route('dashboard.purchases.store'), {
    seller_id: 0,
    info_array: [{ title_id: 0, price_usd: '', price_gel: '', quantity: '' }]
})
let touchedFields = new Set();

watch(() => form.data(), (newData, oldData) => {
    let changedFields = Object.keys(newData).filter(field => newData[field] !== oldData);
    touchedFields = new Set([...changedFields, ...touchedFields]);
    console.log(touchedFields);
})

But it check only (seller_id) field. How can I watch info_array?

0 likes
2 replies
mrguseynov's avatar

@Niush But how to get names of changed fields. It only shows that info_array changed, I need to get changed names of fields in info_array

Please or to participate in this conversation.