点赞变蓝-数字加1效果

点赞变蓝-数字加1效果

图例
在这里插入图片描述

<div class="b-j">
    <div class="b-ja" @click="watch()">
        <div style="margin-left:14px">
            <div v-if="!detaList.active">
                <img src="../../assets/images/dz_h.png" alt />
                <p>{{detaList.upvote}}</p>
            </div>
            <div v-if="detaList.active">
                <img src="../../assets/images/dz_l.png" alt />
                <p style="color:#409eff">{{detaList.upvote}}</p>
            </div>
        </div>
    </div>
</div>

在这里插入图片描述

方法

data(){
    return{
     // 问题详情
      detaList: {
        related_interpretation: [],
        related_question: [],
        related_law: [],
      },
      upvote: '',
    }
}

created() {
    // 获取问题详情数据
    this.getDeta()
},


// 点赞
watch() {
    this.$http.get('/FAQ/praise', { id: this.$route.query.id }).then(
        (response) => {
            if (response.code !== 200) {
                this.$message.error(`问题点赞失败,原因: ${response.message}`)
            } else {
                this.detaList.active = response.result.active
                this.detaList.upvote = response.result.upvote
            }
        },
        (error) => {
            this.$message.error(`问题点赞失败`)
        }
    )
},

    
 // get请求 get('地址','{params:数据}')
async getDeta() {
    let res = await this.$http.get('/FAQ/detail', {
        id: this.$route.query.id,
    })

    if (res.code != 200) {
        this.$router.push('/404')
    } else {
        this.detaList = res.result
    }
},

样式

.b-j {
    float: left;
    width: 122px;
    height: 50px;
    background: #f7f8fa;
    border-radius: 4px;
    margin-top: 20px;
    cursor: pointer; /*鼠标悬停变小手*/
    img {
        float: left;
        width: 22x;
        height: 22px;
        margin-left: 30px;
        margin-top: 14px;
        margin-bottom: 14px;
        margin-right: 8px;
    }
    p {
        float: left;
        font-size: 16px;
        color: #555555;
        line-height: 22px;
        height: 22px;
        margin: 14px 0px;
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值