您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

layout-numberplate-color.vue 2.5KB

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