File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
3
<slot ></slot >
4
- <span :class =" `vjs-value vjs-value__${dataType}`" v-html =" textFormatter(data)" />
4
+ <span v-if =" customValueFormatter" :class =" valueClass" v-html =" customFormatter(data)" />
5
+ <span v-else :class =" valueClass" >{{ defaultFormatter(data) }}</span >
5
6
</div >
6
7
</template >
7
8
18
19
customValueFormatter: Function
19
20
},
20
21
computed: {
22
+ valueClass () {
23
+ return ` vjs-value vjs-value__${ this .dataType } `
24
+ },
25
+
21
26
// 当前数据类型
22
27
dataType () {
23
28
return getDataType (this .data )
36
41
return text
37
42
},
38
43
39
- textFormatter (data ) {
40
- if (this .customValueFormatter ) {
41
- return this .customValueFormatter (
42
- data, this .currentKey , this .parentData
43
- ) || this .defaultFormatter (data)
44
- } else {
45
- return this .defaultFormatter (data)
46
- }
44
+ customFormatter (data ) {
45
+ return this .customValueFormatter (
46
+ data, this .currentKey , this .parentData
47
+ ) || this .defaultFormatter (data)
47
48
}
48
49
}
49
50
}
You can’t perform that action at this time.
0 commit comments