attribute.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. const props = defineProps({
  4. data: {
  5. type: Object,
  6. default: () => ({
  7. properties: [
  8. {
  9. chinaName: 'Color',
  10. },
  11. ],
  12. }),
  13. },
  14. })
  15. const is_open = ref(false)
  16. const propertiesList = computed(() => {
  17. const originList = props.data?.propertiesList
  18. if (!originList)
  19. return []
  20. const list = originList?.filter((item: any) => item.englishName)
  21. if (list.length > 9)
  22. return list.slice(0, 9)
  23. return list
  24. })
  25. </script>
  26. <template>
  27. <div>
  28. <div
  29. class="text-16px fw-700 flex items-center cursor-pointer mb-20px"
  30. @click="is_open = !is_open"
  31. >
  32. Other attributes
  33. <svgo-arrow-rotate
  34. class="!w-18px !h-18px ml-10px"
  35. :class="is_open ? 'rotate-180' : ''"
  36. />
  37. </div>
  38. <div
  39. v-show="is_open && propertiesList && propertiesList.length"
  40. class="grid w-1400px grid-cols-3"
  41. >
  42. <div v-for="item in propertiesList" :key="item.id" class="py-10px flex">
  43. <div class="w-auto text-#999">
  44. {{
  45. item.englishName
  46. }}&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;
  47. </div>
  48. <div class="text-#333">
  49. {{ item.value }}
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <style lang="less" scoped></style>