Has that boss ever done the function of giving likes on vue? when he interacts with the background, he sends me a dome.

< span class= "praise-style" @ click= "clickFabulous (item)" >

            <i v-if="item.essence" class="iconfont icon-xihuan iconr"></i>
            <i v-if="!item.essence" class="iconfont icon-like iconr"></i>
             {{item.likeCount}}
          </span>
          
          
             // 
  clickFabulous (item){
    // 
    if (!this.islogin) {
      this.$router.push({path: "/login"})
    }else{
      item.essence =false
    }
  },
  -sharp-sharp-sharp 

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Jul.29,2021

tell me what you do. Give the like button two classes (class)

.

get the data of the content asynchronously when entering the content details

there is a

in it.
{
    "id":"",
    "linkNumber":"10",
    "like":true/false
}

display the like button when like is true and the button to cancel likes is false

Button method in the page

linkDetail(){
// 
    this.$post('detail/'+ this+ id)
    .then((result)=>{
        // 
        if(result.status === 1){
        //
            this.detail.like = !this.detail.like;
        }else{
        }
    })
    .catch()
 
}

the backend is the same in both go and php

check whether the user likes the article. If there is, cancel it. If not, like it

.
Menu