|
12 | 12 | {{ data.szName }} |
13 | 13 | <i class="u-interact" v-if="data.bInteract"></i> |
14 | 14 | </div> |
15 | | - <!-- <div class="u-attrs"> |
16 | | - <span class="u-attr" v-if="data.Attribute1"><span class="u-label blue">观赏</span>{{ data.Attribute1 }}</span> |
17 | | - <span class="u-attr" v-if="data.Attribute2"><span class="u-label pink">实用</span>{{ data.Attribute2 }}</span> |
18 | | - <span class="u-attr" v-if="data.Attribute3"><span class="u-label yellow">坚固</span>{{ data.Attribute3 }}</span> |
19 | | - <span class="u-attr" v-if="data.Attribute4"><span class="u-label green">风水</span>{{ data.Attribute4 }}</span> |
20 | | - <span class="u-attr" v-if="data.Attribute5"><span class="u-label purple">趣味</span>{{ data.Attribute5 }}</span> |
21 | | - </div> --> |
22 | | - <div class="u-attrs" v-if="data.Record || data.Record === 0"> |
23 | | - <span class="u-attr" |
| 15 | + <div class="u-attrs" v-if="data.Record || data.Record === 0 || furniture_attrs.length"> |
| 16 | + <span class="u-attr" v-if="data.Record || data.Record === 0" |
24 | 17 | ><span class="u-label score">装修评分</span>{{ data.Record }}</span |
25 | 18 | > |
| 19 | + <span class="u-attr" v-for="item in furniture_attrs" :key="item.key" |
| 20 | + ><span class="u-label" :class="item.className">{{ item.label }}</span>{{ item.value }}</span |
| 21 | + > |
26 | 22 | </div> |
27 | 23 | <div class="u-metas"> |
28 | 24 | <span class="u-meta" |
@@ -363,13 +359,22 @@ export default { |
363 | 359 | return getFurnitureType(this.data, this.category); |
364 | 360 | }, |
365 | 361 | furniture_attrs: function () { |
| 362 | + const hasAttrValue = (value) => ![undefined, null, ""].includes(value); |
| 363 | + const useDefaultAttrs = |
| 364 | + Number(this.data?.nFurnitureType) === 2 && |
| 365 | + !this.data?.Attribute1 && |
| 366 | + !this.data?.Attribute2 && |
| 367 | + !this.data?.Attribute3 && |
| 368 | + !this.data?.Attribute4 && |
| 369 | + !this.data?.Attribute5; |
| 370 | +
|
366 | 371 | return [ |
367 | | - { key: "view", label: "观赏", value: this.data?.Attribute1, className: "blue" }, |
368 | | - { key: "practical", label: "实用", value: this.data?.Attribute2, className: "pink" }, |
369 | | - { key: "strong", label: "坚固", value: this.data?.Attribute3, className: "yellow" }, |
370 | | - { key: "fengshui", label: "风水", value: this.data?.Attribute4, className: "green" }, |
371 | | - { key: "interest", label: "趣味", value: this.data?.Attribute5, className: "purple" }, |
372 | | - ].filter((item) => item.value); |
| 372 | + { key: "view", label: "观赏", value: useDefaultAttrs ? 1 : this.data?.Attribute1, className: "blue" }, |
| 373 | + { key: "practical", label: "实用", value: useDefaultAttrs ? 1 : this.data?.Attribute2, className: "pink" }, |
| 374 | + { key: "strong", label: "坚固", value: useDefaultAttrs ? 1 : this.data?.Attribute3, className: "yellow" }, |
| 375 | + { key: "fengshui", label: "风水", value: useDefaultAttrs ? 1 : this.data?.Attribute4, className: "green" }, |
| 376 | + { key: "interest", label: "趣味", value: useDefaultAttrs ? 1 : this.data?.Attribute5, className: "purple" }, |
| 377 | + ].filter((item) => hasAttrValue(item.value)); |
373 | 378 | }, |
374 | 379 |
|
375 | 380 | has_extend: function () { |
|
0 commit comments