You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

layout-numberplate-color.vue 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!-- 车牌颜色选择组件 -->
  2. <template>
  3. <view class="numberplates">
  4. <view class="numberplate" v-for="(item,index) in state.numberplateColorList" @click="checkNumberplateColor(item)" :key="index">
  5. <image :src="`${$imgUrl}issueActivation/${item.src}.png`" class="numberplate-bg"></image>
  6. <view class="numberplate-name" :style="`color:${item.color}`">{{numberplate}}</view>
  7. <image :src="`${$imgUrl}issueActivation/${item.checkSrc}.png`" class="numberplate-icon-check"
  8. v-if="item.id === state.curCheckId"></image>
  9. </view>
  10. </view>
  11. </template>
  12. <script setup lang="ts">
  13. import { onMounted, reactive } from "vue";
  14. const emit = defineEmits(['numberplateResult'])
  15. const props = defineProps({
  16. //显示的车牌
  17. numberplate:{
  18. type:String,
  19. default:'贵A12345'
  20. },
  21. //当前选择的车牌
  22. numberplateCor:{
  23. type:Object,
  24. default:()=>{return {id:-1}}
  25. }
  26. })
  27. const state = reactive({
  28. curCheckId:-1, //当前选择的车牌
  29. numberplateColorList:[//车牌颜色
  30. {src:'bg-blue',checkSrc:'icon-select-blue',id:0,color:'#ffffff',title:'蓝色'},
  31. {src:'bg-orange',checkSrc:'icon-select-orange',id:1,color:'#000000',title:'黄色'},
  32. {src:'bg-black',checkSrc:'icon-select-black',id:2,color:'#ffffff',title:'黑色'},
  33. {src:'bg-white',checkSrc:'icon-select-white',id:3,color:'#000000',title:'白色'},
  34. {src:'bg-green',checkSrc:'icon-select-green',id:4,color:'#000000',title:'渐变绿色'},
  35. {src:'bg-yellow_green',checkSrc:'icon-select-yellow_green',id:5,color:'#000000',title:'黄绿双拼'},
  36. {src:'bg-white_blue',checkSrc:'icon-select-blue',id:6,color:'#000000',title:'蓝白渐变'},
  37. {src:'green',checkSrc:'icon-green',id:11,color:'#ffffff',title:'绿色'},
  38. {src:'rad',checkSrc:'icon-select-red',id:12,color:'#ffffff',title:'红色'},
  39. ],
  40. })
  41. /* 选择车牌颜色 */
  42. const checkNumberplateColor = (item) => {
  43. state.curCheckId = item.id;
  44. emit('numberplateResult',item)
  45. }
  46. onMounted(()=>{
  47. state.curCheckId = props.numberplateCor.id;
  48. })
  49. </script>
  50. <style lang="scss" scoped>
  51. .numberplates{
  52. display: flex;
  53. flex-direction: row;
  54. flex-wrap: wrap;
  55. justify-content: space-around;
  56. .numberplate{
  57. display: flex;
  58. justify-content: center;
  59. align-items: center;
  60. // margin-right: 60rpx;
  61. margin-bottom: 40rpx;
  62. position: relative;
  63. &:nth-child(even){
  64. margin-right: 0rpx;
  65. }
  66. &-bg{
  67. width: 190rpx;
  68. height: 80rpx;
  69. }
  70. &-name{
  71. font-size: 30rpx;
  72. color: white;
  73. position: absolute;
  74. line-height: 80rpx;
  75. }
  76. &-icon-check{
  77. width: 40rpx;
  78. height: 40rpx;
  79. position: absolute;
  80. right: -12rpx;
  81. bottom: -12rpx;
  82. }
  83. }
  84. }
  85. </style>