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:'bg-white_blue',checkSrc:'icon-select-blue',id:11,color:'#000000',title:'绿色'},
  38. // {src:'bg-white_blue',checkSrc:'icon-select-blue',id:12,color:'#000000',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. .numberplate{
  56. display: flex;
  57. justify-content: center;
  58. align-items: center;
  59. margin-right: 60rpx;
  60. margin-bottom: 40rpx;
  61. position: relative;
  62. &:nth-child(even){
  63. margin-right: 0rpx;
  64. }
  65. &-bg{
  66. width: 230rpx;
  67. height: 80rpx;
  68. }
  69. &-name{
  70. font-size: 30rpx;
  71. color: white;
  72. position: absolute;
  73. line-height: 80rpx;
  74. }
  75. &-icon-check{
  76. width: 40rpx;
  77. height: 40rpx;
  78. position: absolute;
  79. right: -12rpx;
  80. bottom: -12rpx;
  81. }
  82. }
  83. }
  84. </style>