detail-cell-sku.vue 702 B

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