productTypes.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="w-screen pad:w-full">
  3. <big-title>{{lang===langType.cn?"产品类别":getAbbrText("产品类别")}}</big-title>
  4. <div class="conBox product-type">
  5. <p
  6. v-for="(item,i) in types"
  7. :key="item.key"
  8. :class="`type-item ${item.key===type?'type-selected':''}`"
  9. @click="selectType(item.key)"
  10. >
  11. <span class="icon-box">
  12. <svg-icon :icon-class="item.icon"/>
  13. </span>
  14. <span class="type-name">{{lang===langType.cn?item.text:getAbbrText(item.text)}}</span>
  15. </p>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import langMap from "@/map/langMap";
  21. import {pTypes} from "~/map/productMap";
  22. import BigTitle from "~/components/public/bigTitle.vue";
  23. export default {
  24. name: "productTypes",
  25. components: {BigTitle},
  26. props: {
  27. lang:{
  28. default: langMap.lang.cn
  29. },
  30. type:{
  31. default: 'all'
  32. }
  33. },
  34. data(){
  35. return {
  36. langType: langMap.lang,
  37. types: pTypes
  38. }
  39. },
  40. methods:{
  41. getLangText(str) {
  42. return langMap.getText(this.lang, str);
  43. },
  44. getAbbrText(str) {
  45. return langMap.getAbbrText(this.lang, str);
  46. },
  47. selectType(nextType){
  48. console.log(nextType)
  49. if (this.type === nextType){
  50. return 0;
  51. }
  52. this.$root.$emit('changeProductType',nextType);
  53. }
  54. }
  55. }
  56. </script>
  57. <style scoped>
  58. .content{
  59. cursor: default;
  60. }
  61. .content .big-title{
  62. margin-top: 10px;
  63. margin-bottom: 30px;
  64. }
  65. .product-type{
  66. height: 120px;
  67. display: grid;
  68. grid-template-columns: repeat(6,1fr);
  69. }
  70. .product-type .type-item{
  71. width: auto;
  72. height: 100%;
  73. cursor: pointer;
  74. }
  75. .product-type .type-item:hover{
  76. color: orangered;
  77. }
  78. .product-type .type-selected{
  79. color: #f88330;
  80. }
  81. .product-type .type-item .icon-box{
  82. width: 100%;
  83. height: 50px;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. font-size: 4rem;
  88. padding-bottom: 20px;
  89. }
  90. .product-type .type-selected .icon-box{
  91. border-bottom: 1px solid deepskyblue;
  92. }
  93. .product-type .type-item .type-name{
  94. width: 100%;
  95. height: 60px;
  96. font-size: 1.3rem;
  97. display: flex;
  98. justify-content: center;
  99. align-items: center;
  100. }
  101. </style>