xianniu-ui 0.9.8 → 0.9.11
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.
- package/lib/xianniu-ui.common.js +39 -34
- package/lib/xianniu-ui.umd.js +39 -34
- package/lib/xianniu-ui.umd.min.js +2 -2
- package/package.json +1 -1
- package/packages/amount/main.vue +15 -10
package/package.json
CHANGED
package/packages/amount/main.vue
CHANGED
|
@@ -6,23 +6,19 @@
|
|
|
6
6
|
:style="prefixStyle"
|
|
7
7
|
v-if="showPrefix && ($slots.prefix || prefix)"
|
|
8
8
|
>
|
|
9
|
-
<slot name="prefix">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</i>
|
|
13
|
-
<slot>{{
|
|
9
|
+
<slot name="prefix">{{ prefix }}</slot>
|
|
10
|
+
</i><!--
|
|
11
|
+
--><slot>{{
|
|
14
12
|
formatValue
|
|
15
13
|
| doPrecision(legalPrecision, isRoundUp)
|
|
16
14
|
| doFormat(hasSeparator, separator)
|
|
17
|
-
}}</slot
|
|
18
|
-
|
|
15
|
+
}}</slot><!--
|
|
16
|
+
--><i
|
|
19
17
|
class="xn-amount-suffix"
|
|
20
18
|
:style="suffixStyle"
|
|
21
19
|
v-if="$slots.suffix || suffix"
|
|
22
20
|
>
|
|
23
|
-
<slot name="suffix">
|
|
24
|
-
{{ suffix }}
|
|
25
|
-
</slot>
|
|
21
|
+
<slot name="suffix">{{ suffix }}</slot>
|
|
26
22
|
</i>
|
|
27
23
|
</template>
|
|
28
24
|
<template v-else>
|
|
@@ -97,10 +93,19 @@ export default {
|
|
|
97
93
|
type: Object,
|
|
98
94
|
default: () => ({}),
|
|
99
95
|
},
|
|
96
|
+
emptyValue: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: "--",
|
|
99
|
+
},
|
|
100
100
|
},
|
|
101
101
|
filters: {
|
|
102
102
|
// 处理精度
|
|
103
103
|
doPrecision(value, precision, isRoundUp) {
|
|
104
|
+
// 处理空值情况
|
|
105
|
+
if (value == null || isNaN(value)) {
|
|
106
|
+
return this.emptyValue;
|
|
107
|
+
}
|
|
108
|
+
|
|
104
109
|
const exponentialForm = Number(`${value}e${precision}`);
|
|
105
110
|
const rounded = isRoundUp
|
|
106
111
|
? Math.round(exponentialForm)
|