How to replace the value of vue.js onclick function after calculation?

it works when I write the event directly on click,

@click="diary.ispraise=1-diary.ispraise,diary.countpraise+=2*diary.ispraise-1" 

when changing to a function to pass a value, I don"t know how to write it. I"d like to ask for advice. no, no, no.

@click="myPra(diary.ispraise,diary.countpraise)"

js:

myPra:function(a,b){
                        a=1-a;
                        b+=2*a-1;
                    }
May.01,2021

you can't pass a value directly

@click="myPra(diary)"
myPra:function(diary){
    diary.ispraise=1-diary.ispraise;
    diary.countpraise+=2*diary.ispraise-1;
}

@ click= "myPra (diary.ispraise,diary.countpraise)" so there is no problem.
only if you make sure that you already have the diary object in your data data, and that you already have the two attributes ispraise,countpraise in the diary object

.

data: {

diary:{
    ispraise: ,
    countpraise:  
}
If you bind in this way again in the

}
page, there will be no error.
@ click= "myPra (diary.ispraise,diary.countpraise)"

Menu