[Vuejs]-VueJs + BootstrapVue: Edit object with data pagination

0👍

I managed to fix my issue by cloning the user object after opening the modal.

<b-button variant="info" @click="editUser(user)">Edit</b-button>
[...]
export default {
    props: {
        user: Object
    },
    data() {
        return {
            modalShow: false,
            editedUser: {},
        }
    },
    methods: {
        editUser(user) {
           this.modalShow = true
           this.editedUser = JSON.parse(JSON.stringify(user));
        }
        onSubmit(evt) {
           [...]
        }
    }
}

However, I still don’t understand why the previous piece of code doesn’t have the same behavior.

Leave a comment