html:

<div class="starBox" ref="star1">
<div class="star" v-for="(item,index) in starArr1" :key="index" @click="starClick1(index)">
<img :src="'../../static/images/'+item.imgSrc">
</div>
</div>

js:

export default {
data () {
return {
starArr1: [{imgSrc: 'star1.png'}, {imgSrc: 'star1.png'}, {imgSrc: 'star1.png'}, {imgSrc: 'star1.png'}, {imgSrc: 'star1.png'}]
}
},
methods: {
starClick1 (index) {
this.starArr1.forEach((element, i) => {
this.$set(element, 'imgSrc', 'star1.png')
if (i <= index) {
this.$set(element, 'imgSrc', 'star2.png')
}
})
this.commentScore[0] = index + 1
}
 }
}

css:

.starBox {
display: flex;
display: -webkit-flex;
}
.starActive {
color: red;
}
.star img {
width: 40px;
height: 20px;
}

最新文章

  1. Object-c 内存管理
  2. Composer根据Name显示与隐藏
  3. android 在使用studio 编写百度地图中遇到APP Scode码校验失败 问题
  4. Multiples of 3 and 5
  5. JAXB 2.0 API is being loaded from the bootstrap classloader
  6. iOS开发HTTPS实现之信任SSL证书和自签名证书
  7. zoj 3755
  8. python基础教程第4章——字典
  9. phantomjs初次认识
  10. hdu_4651_Partition(公式)
  11. CountDownLatch的实现原理
  12. C语言学生管理系统(增进版)
  13. SQL Server读写分离之发布订阅
  14. [Swift]LeetCode856. 括号的分数 | Score of Parentheses
  15. php 一行代码解决二维数组去重
  16. linux下的网络通信设置:openssh、PuTTY、tightVNC
  17. linux下如何解除被占用的端口号
  18. centos7安装redis单机版
  19. PHP——语句和时间函数
  20. JS-制作留言提交系统(支持ctrl+回车)

热门文章

  1. 【python】遇到的错误
  2. finalize的作用
  3. ES6 学习 -- 解构赋值
  4. 在Linux(centos)下,安装Apache和PHP环境
  5. canvas插入图片设置背景,渐变
  6. Python 输入字符串找(String)下标 没有返回-1
  7. drop database出现1010
  8. leetcode-240-搜索二维矩阵②
  9. Sublime text2 + cygwin编译C++
  10. hexo next主题中遇到的关于require的timeout的问题。Uncaught Error: Load timeout for modules: