en-eva.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="en-eva">
  3. <view class="en-eva-box" v-if="type">
  4. <view class="n-x">
  5. <image v-for="(item,i) in 5" :key="i"
  6. src="@/static/img/index/xing-n.png" mode=""></image>
  7. </view>
  8. <view class="s-x">
  9. <image v-for="(item,i) in num" :key="i"
  10. src="@/static/img/index/index-x.png" mode=""></image>
  11. </view>
  12. </view>
  13. <view class="en-eva-box" v-else>
  14. <view class="n-x">
  15. <image v-for="(item,i) in 5" :key="i" @click="select(i)"
  16. src="@/static/img/index/xing-n.png" mode=""></image>
  17. </view>
  18. <view class="s-x">
  19. <image v-for="(item,i) in numList" :key="i" @click="select(i)"
  20. src="@/static/img/index/index-x.png" mode=""></image>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name:'en-eva',
  28. props:{
  29. // true 只做显示 false 可编辑
  30. type:{
  31. type: Boolean,
  32. default:true,
  33. },
  34. num:{
  35. type: Number,
  36. default:0,
  37. },
  38. },
  39. data(){
  40. return{
  41. numList:0,
  42. }
  43. },
  44. methods:{
  45. select(i){
  46. this.numList = i+1
  47. this.$nextTick();
  48. this.$emit('getEvaNum',this.numList)
  49. },
  50. },
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .en-eva{
  55. width: 140rpx;
  56. height: 24rpx;
  57. .en-eva-box{
  58. width: 140rpx;
  59. height: 24rpx;
  60. position: relative;
  61. image{
  62. width: 19rpx;
  63. height: 19rpx;
  64. margin-right: 4rpx;
  65. }
  66. .n-x{
  67. display: flex;
  68. position: absolute;
  69. z-index: 1;
  70. }
  71. .s-x{
  72. display: flex;
  73. position: absolute;
  74. z-index: 2;
  75. }
  76. }
  77. }
  78. </style>