fix: 修正产品规格值product_spec的显示问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m8s

- subItem.value => subItem.key
- 调整后端CMS的结构,将规格值移入translations中
This commit is contained in:
2025-10-31 15:06:08 +08:00
parent dbc84d5a21
commit dd7ac909fb
4 changed files with 31 additions and 14 deletions

View File

@ -11,7 +11,7 @@
<el-descriptions-item
v-for="subItem in item.specs"
:key="subItem.key"
:label="subItem.value"
:label="subItem.key"
>
{{ subItem.value }}
</el-descriptions-item>

View File

@ -34,9 +34,8 @@ export const useProduct = (id: string) => {
specs: [
'id',
{
translations: ['id', 'key'],
translations: ['id', 'key', 'value'],
},
'value',
],
},
],

View File

@ -61,12 +61,13 @@ export function toProductSpecGroupView(
export function toProductSpecView(raw: ProductSpec): ProductSpecView {
const trans = raw.translations?.[0] ?? {
key: '',
value: '',
};
return {
id: raw.id,
key: trans.key,
value: raw.value,
value: trans.value,
};
}