@jx3box/jx3box-ui 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-ui",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,9 +1,13 @@
1
1
  <template>
2
- <span class="c-game-price" :class="{ 'is-align': align }">
2
+ <span class="c-game-price" :class="alignClass">
3
3
  <span class="u-neg" v-if="numericPrice < 0">- </span>
4
- <span v-for="part in priceParts" :key="part.unit" :class="`u-${part.unit}`">
5
- <span class="u-value">{{ part.value }}</span>
6
- <img :src="part.icon" :alt="part.alt" />
4
+ <span class="u-price">
5
+ <template v-for="part in priceParts" :key="part.unit">
6
+ <span class="u-part" :class="`u-${part.unit}`">
7
+ <span class="u-price-value">{{ part.value }}</span>
8
+ <img :src="part.icon" :alt="part.alt" />
9
+ </span>
10
+ </template>
7
11
  </span>
8
12
  </span>
9
13
  </template>
@@ -29,7 +33,7 @@ export default {
29
33
  default: 0,
30
34
  },
31
35
  align: {
32
- type: Boolean,
36
+ type: [Boolean, String],
33
37
  default: false,
34
38
  },
35
39
  },
@@ -38,6 +42,11 @@ export default {
38
42
  const value = Number(this.price);
39
43
  return Number.isFinite(value) ? Math.trunc(value) : 0;
40
44
  },
45
+ alignClass() {
46
+ if (this.align === true) return "is-align";
47
+ if (typeof this.align === "string" && this.align) return `is-${this.align}`;
48
+ return "";
49
+ },
41
50
  priceParts() {
42
51
  const value = Math.abs(this.numericPrice);
43
52
  let remainder = value;
@@ -51,58 +60,75 @@ export default {
51
60
  };
52
61
  });
53
62
 
54
- const visibleParts = parts.filter((item) => item.value > 0);
63
+ const zhuanIndex = parts.findIndex((item) => item.unit === "zhuan");
64
+ const jinIndex = parts.findIndex((item) => item.unit === "jin");
55
65
 
56
- if (!visibleParts.length) {
57
- const tong = parts.find((item) => item.unit === "tong");
58
- return tong ? [{ ...tong, value: 0 }] : [];
66
+ if (parts[zhuanIndex] && parts[zhuanIndex].value > 0) {
67
+ return parts.slice(zhuanIndex);
59
68
  }
60
69
 
61
- return visibleParts;
70
+ return parts.slice(jinIndex);
62
71
  },
63
72
  },
64
73
  };
65
74
  </script>
66
75
 
67
76
  <style lang="less">
68
- /* src/wiki/GamePrice.vue */
69
77
  .c-game-price {
70
78
  display: inline-flex;
71
79
  align-items: center;
72
- flex-wrap: nowrap;
73
- white-space: nowrap;
80
+ color: #333;
81
+ font-weight: 500;
74
82
 
75
- .u-neg,
76
- .u-zhuan,
77
- .u-jin,
78
- .u-yin,
79
- .u-tong {
83
+ .u-price {
80
84
  display: inline-flex;
81
85
  align-items: center;
82
- flex-shrink: 0;
86
+ flex-wrap: wrap;
87
+ gap: 6px;
88
+ }
89
+
90
+ .u-neg {
91
+ display: inline-flex;
92
+ align-items: center;
93
+ }
94
+
95
+ .u-part {
96
+ display: inline-flex;
97
+ align-items: center;
98
+ gap: 2px;
99
+ white-space: nowrap;
83
100
  }
84
101
 
85
102
  img {
86
- display: inline-block;
87
- .y;
103
+ width: 18px;
104
+ height: 18px;
105
+ object-fit: contain;
106
+ vertical-align: middle;
107
+ }
108
+
109
+ .u-price-value {
110
+ .fz(12px,18px);
88
111
  }
89
112
 
90
113
  &.is-align {
91
114
  .u-jin {
92
- .u-value {
115
+ .u-price-value {
93
116
  display: inline-block;
94
- width: 4ch;
95
117
  text-align: right;
96
118
  }
97
119
  }
98
120
  .u-yin,
99
121
  .u-tong {
100
- .u-value {
122
+ .u-price-value {
101
123
  display: inline-block;
102
- width: 2ch;
103
124
  text-align: right;
104
125
  }
105
126
  }
106
127
  }
128
+
129
+ &.is-right {
130
+ justify-content: flex-end;
131
+ width: 100%;
132
+ }
107
133
  }
108
134
  </style>