加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Vue动态实现评分效果

发布时间:2020-12-17 02:56:53 所属栏目:百科 来源:网络整理
导读:本文实例为大家分享了Vue动态实现评分效果的具体代码,供大家参考,具体内容如下 1.图片分为三种 on: half: off 根据需求改变代码 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

本文实例为大家分享了Vue动态实现评分效果的具体代码,供大家参考,具体内容如下

1.图片分为三种

on:

half:

off

.star{ font-size: 0; } .star-item{ display: inline-block; background-repeat: no-repeat; width: 20px; height: 20px; margin-right: 22px; background-size: 100%; } .star-item.on{ background-image: url(img/on.png); } .star-item.half{ background-image: url(img/half.png); } .star-item.off{ background-image: url(img/off.png); }
new Vue({ el: '#app', data:{ score: 4 },computed:{ //计算属性 itemClasses(){ let result = []; let score = Math.floor(this.score * 2 ) / 2; let hasDecimal = score % 1 !== 0; let integer = Math.floor(score); for(let i=0;i

根据需求改变代码

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读