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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!-- 车牌颜色选择组件 -->
  2. <template>
  3. <view class="numberplates">
  4. <view class="numberplate" v-for="(item,index) in state.numberplateColorList" @click="checkNumberplateColor(item)">
  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:'贵A1234'
  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:1,color:'#ffffff',title:'蓝色'},
  31. {src:'bg-green',checkSrc:'icon-select-green',id:2,color:'#000000',title:'渐变绿色'},
  32. {src:'bg-orange',checkSrc:'icon-select-orange',id:3,color:'#000000',title:'黄色'},
  33. {src:'bg-yellow_green',checkSrc:'icon-select-yellow_green',id:4,color:'#000000',title:'黄绿双拼'},
  34. {src:'bg-black',checkSrc:'icon-select-black',id:5,color:'#ffffff',title:'黑色'},
  35. {src:'bg-white',checkSrc:'icon-select-white',id:6,color:'#000000',title:'白色'},
  36. {src:'bg-white_blue',checkSrc:'icon-select-blue',id:7,color:'#000000',title:'蓝白渐变'},
  37. ],
  38. })
  39. /* 选择车牌颜色 */
  40. const checkNumberplateColor = (item) => {
  41. state.curCheckId = item.id;
  42. emit('numberplateResult',item)
  43. }
  44. onMounted(()=>{
  45. state.curCheckId = props.numberplateCor.id;
  46. })
  47. </script>
  48. <style lang="scss" scoped>
  49. .numberplates{
  50. display: flex;
  51. flex-direction: row;
  52. flex-wrap: wrap;
  53. .numberplate{
  54. display: flex;
  55. justify-content: center;
  56. align-items: center;
  57. margin-right: 60rpx;
  58. margin-bottom: 40rpx;
  59. position: relative;
  60. &:nth-child(even){
  61. margin-right: 0rpx;
  62. }
  63. &-bg{
  64. width: 230rpx;
  65. height: 80rpx;
  66. }
  67. &-name{
  68. font-size: 30rpx;
  69. color: white;
  70. position: absolute;
  71. line-height: 80rpx;
  72. }
  73. &-icon-check{
  74. width: 40rpx;
  75. height: 40rpx;
  76. position: absolute;
  77. right: -12rpx;
  78. bottom: -12rpx;
  79. }
  80. }
  81. }
  82. </style>