index.vue 602 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <view class="box">
  3. <text class="iconfont icon-kaixinxingxing" v-for="(v,i) in 5" :key="i" @click="rate(i+1)" :class="{active:i<value}"></text>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data () {
  9. return {
  10. }
  11. },
  12. props: {
  13. value: {
  14. type: Number | String,
  15. default: 3
  16. }
  17. },
  18. methods: {
  19. rate (index) {
  20. this.$emit('change', index)
  21. }
  22. },
  23. }
  24. </script>
  25. <style lang='scss' scoped>
  26. .box {
  27. display: flex;
  28. > text {
  29. display: inline-block;
  30. margin-right: 5rpx;
  31. color: #b3b3b3;
  32. }
  33. > .active {
  34. color: #f7931e;
  35. }
  36. }
  37. </style>