[Vuejs]-Need help refactoring my vuejs code. Error v-on handler: "TypeError: Cannot read property 'products' of undefined"

0👍

I fixed my issue. I need to pay closer attention while copying and pasting.

This is the correct code snippet:

 <!-- New Product -->
            <b-button variant="success" class="mt-2 mb-2"
                    @click="addNewProductForm(catIndex)">
                New Product
            </b-button>

            <b-card class="mb-3" v-for="(product, index) in category.products">
                <span class="float-right" 
                    style="cursor:pointer"
                    @click="deleteProductForm(catIndex, index)">
                    X
                </span>

Leave a comment