@neatui/vue 1.2.1 → 1.2.3
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/package.json
CHANGED
|
@@ -41,8 +41,30 @@
|
|
|
41
41
|
import { ref, reactive, watch, onMounted, onUnmounted, computed } from 'vue';
|
|
42
42
|
import { useRoute } from 'vue-router';
|
|
43
43
|
import scrollTo from '@fekit/scrollto';
|
|
44
|
-
import { findEnumName } from '@/utils';
|
|
45
44
|
import { diff, deepcopy, isArray } from '@fekit/utils';
|
|
45
|
+
|
|
46
|
+
// 通过枚举值查找枚举名
|
|
47
|
+
const findEnumName = (enums: any, val: any, join: boolean | string = ' Ι ') => {
|
|
48
|
+
// 转换核心
|
|
49
|
+
const _core = (v: any) => {
|
|
50
|
+
const { label = v }: any = enums.find(({ value = '' }: any) => value == v) || {};
|
|
51
|
+
return label;
|
|
52
|
+
};
|
|
53
|
+
// 判断枚举字典是否可用
|
|
54
|
+
if (enums && enums.find) {
|
|
55
|
+
// 兼容多种入参类型
|
|
56
|
+
if (isArray(val)) {
|
|
57
|
+
// 数组
|
|
58
|
+
const arr = val.map((i: any) => _core(i));
|
|
59
|
+
return join ? arr.join(join) : arr;
|
|
60
|
+
} else {
|
|
61
|
+
return _core(val);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
return val;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
46
68
|
const emits = defineEmits(['update:data', 'confirm', 'discard']);
|
|
47
69
|
const route: any = useRoute();
|
|
48
70
|
const props: any = defineProps({
|