0

I'm having a data set which is by default have following:

summaries: [{client:'', type: '', mention: '', action: '', comment: '', button: true}],

I've a button which adds the same data set into summaries data:

addSummary() {
    this.summaryHeaders = true;
    this.summaries.push({
        client: '',
        type: '',
        mention: '',
        action: '',
        comment:'',
        button: true
    })
},

Now I'm having other button, while being clicked I want to update button attribute as false of that particular data set. How can I achieve this?

1 Answer 1

1

You might be using v-for loop to render the summaries array

So to the method which gets called on click which should update the button property pass, the single item from the array you are looping through

<duv v-for="(summary,index) in summaries">
    <p>{{summary}}</p>
    <button @click="updatProperty(summary, index)">Update button attribute</button>
</div>

then in your methods

methods:{
    updatProperty(summary){
        summary.button = false;
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.