fix product/sku name
This commit is contained in:
@@ -14,10 +14,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ProductSkuSpecSnapshot } from "@/types/Product";
|
||||
import { getProductSkuSnapshotText } from "@/utils/product";
|
||||
|
||||
defineOptions({ name: "ProductSkuSnapshotTags" });
|
||||
|
||||
interface Props {
|
||||
productName?: string | null;
|
||||
snapshot?: ProductSkuSpecSnapshot[];
|
||||
fallback?: string;
|
||||
unit?: string | null;
|
||||
@@ -30,10 +32,11 @@ const tagList = computed(() => {
|
||||
const content = item.specValueName?.trim() || item.specName?.trim();
|
||||
return content ? [{ key: `${item.specId || "spec"}-${item.specValueId || index}`, content }] : [];
|
||||
});
|
||||
if (result.length || !props.fallback?.trim()) {
|
||||
const fallback = getProductSkuSnapshotText(props.productName, props.fallback);
|
||||
if (result.length || !fallback) {
|
||||
return result;
|
||||
}
|
||||
return [{ key: "fallback", content: props.fallback.trim() }];
|
||||
return [{ key: "fallback", content: fallback }];
|
||||
});
|
||||
const unitText = computed(() => props.unit?.trim() || "");
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user