L
L
lolrofl012018-11-12 22:52:12
Vue.js
lolrofl01, 2018-11-12 22:52:12

How to add an entry to an object that is in props?

Through props, I added an object to the component. The code is like this:

export default {
        props: [
            'object'
        ],
    }

How to add another entry to object now? To understand why - a list of records is made. When adding a new record, I would like to immediately add this record to the object so that it is immediately displayed on the site without reloading and other things

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philip Gaponenko, 2018-11-13
@lolrofl01

this.object.foo = bar?
In general, a warning should fall due to the fact that it is not recommended to change props.
I think it would be optimal to initialize the local property of the component with the value from props and then work with the local property.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question