0

I'm trying to do multiple things within button click (using Vuetify framework):

<v-btn flat color="indigo darken-3" 
@click.stop="dialogDelete = true"  
@click.stop="deleteTemporaryId = offer.id">Delete</v-btn>

But it seems wrong, I've got an error:

duplicate attribute: @click.stop

Anyone knows how to write correctly in Vuejs? Can I ask also multiple functions on @click?

Thank you for help

3 Answers 3

12

You can use arrow function for @click.stop:

@click.stop="()=>{dialogDelete = true; deleteTemporaryId = offer.id}"
Sign up to request clarification or add additional context in comments.

3 Comments

This should not be encouraged. To this type of things its way better to use a method to handle the logic.
@tiagojpdias agree. For simple function, it's ok. For complex one, it's better to create a new method.
I will follow the method solution
7

You can use one method

<v-btn @click.stop="setDeleteDialog(offer.id)"

methods: {
  setDeleteDialog (offerId) {
    this.dialogDelete = true
    this.deleteTemporaryId = offerId
  }
}

Comments

1

This is a bit old and perhaps not previously possible, but for anyone landing here now, this can be achieved without an arrow function, i.e.:

@click.stop="dialogDelete = true; deleteTemporaryId = offer.id"

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.