presets.uts
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* CustomEmpty 预设配置:放在 .uts 中,避免 uvue 内大量字符串字面量触发 Android kotlin/java String(error17)
*/
export type EmptyTypeConfig = {
icon: String
title: String
}
export type PresetTypesMap = {
base: EmptyTypeConfig
home: EmptyTypeConfig
common: EmptyTypeConfig
contract: EmptyTypeConfig
function: EmptyTypeConfig
}
export const TYPE_ICON_BASE_PATH: String = "/static/empty/"
export const PRESET_TYPES: PresetTypesMap = {
base: {
icon: "icon-base-empty.png",
title: "暂无数据"
},
home: {
icon: "icon-home-empty.png",
title: "暂无数据"
},
common: {
icon: "icon-common-empty.png",
title: "暂无数据"
},
contract: {
icon: "icon-contract-empty.png",
title: "请先选择合同,签约个人信息自动带出"
},
function: {
icon: "icon-function-empty.png",
title: "请先选择合同,签约个人信息自动带出"
}
}
export function getEmptyPreset(preset: String): EmptyTypeConfig | null {
if (preset == "base") return PRESET_TYPES.base
if (preset == "home") return PRESET_TYPES.home
if (preset == "common") return PRESET_TYPES.common
if (preset == "contract") return PRESET_TYPES.contract
if (preset == "function") return PRESET_TYPES.function
return null
}
/** defineProps 默认值用 .uts 字面量,减轻 uvue 侧 String 桥接问题 */
export const EMPTY_PROP_DEFAULT_PRESET: String = "base"
export const EMPTY_PROP_DEFAULT_ICON: String = ""
export const EMPTY_PROP_DEFAULT_TITLE: String = ""
export const EMPTY_PROP_DEFAULT_DESCRIPTION: String = ""
export const EMPTY_FALLBACK_TITLE: String = "暂无数据"