detail-cell-sku.vue 763 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <!-- SKU 选择的提示框 -->
  3. <detail-cell :label="$t('common.select')" :value="value" />
  4. </template>
  5. <script setup>
  6. import {
  7. computed
  8. } from 'vue';
  9. import detailCell from './detail-cell.vue';
  10. import { t } from '@/locale'
  11. const props = defineProps({
  12. modelValue: {
  13. type: Array,
  14. default () {
  15. return [];
  16. },
  17. },
  18. sku: {
  19. type: Object
  20. }
  21. });
  22. const value = computed(() => {
  23. if (!props.sku?.id) {
  24. return t('common.select_product_specification');
  25. }
  26. let str = '';
  27. props.sku.properties.forEach(property => {
  28. if (property.valueName === property.propertyName) {
  29. str += property.propertyName;
  30. } else {
  31. str += property.propertyName + ':' + property.valueName + ' ';
  32. }
  33. });
  34. return str;
  35. });
  36. </script>