productTypes.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="w-screen pad:w-full">
  3. <big-title>{{lang===langType.cn?"产品类别":getAbbrText("产品类别")}}</big-title>
  4. <div class="conBox container 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 :svgHref="item.icon"/>
  13. </span>
  14. <span class="type-name">{{lang===langType.cn?item.text:item.en_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. types: {
  34. type: Array,
  35. required: true
  36. },
  37. title: {
  38. default: '产品类别'
  39. }
  40. },
  41. data(){
  42. return {
  43. langType: langMap.lang,
  44. }
  45. },
  46. methods:{
  47. getLangText(str) {
  48. return langMap.getText(this.lang, str);
  49. },
  50. getAbbrText(str) {
  51. return langMap.getAbbrText(this.lang, str);
  52. },
  53. selectType(nextType){
  54. console.log(nextType)
  55. if (this.type === nextType){
  56. return 0;
  57. }
  58. this.$root.$emit('changeType', nextType);
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped>
  64. .content{
  65. cursor: default;
  66. }
  67. .content .big-title{
  68. margin-top: 10px;
  69. margin-bottom: 30px;
  70. }
  71. .product-type{
  72. height: 120px;
  73. display: flex;
  74. justify-content: space-around;
  75. }
  76. .product-type .type-item{
  77. width: auto;
  78. height: 100%;
  79. cursor: pointer;
  80. }
  81. .product-type .type-item:hover{
  82. color: orangered;
  83. }
  84. .product-type .type-selected{
  85. color: #f88330;
  86. }
  87. .product-type .type-item .icon-box{
  88. width: 100%;
  89. height: 50px;
  90. display: flex;
  91. justify-content: center;
  92. align-items: center;
  93. font-size: 4rem;
  94. padding-bottom: 20px;
  95. }
  96. .product-type .type-selected .icon-box{
  97. border-bottom: 1px solid deepskyblue;
  98. }
  99. .product-type .type-item .type-name{
  100. width: 100%;
  101. height: 60px;
  102. font-size: 1.3rem;
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. }
  107. </style>