b26389a0
xiaofengsha
* 对照AntDesign,实现了...
|
1
|
<template>
|
e9ad2b7a
梁灏
update Divider
|
2
3
4
5
6
|
<div :class="classes">
<span v-if="hasSlot" :class="slotClasses">
<slot></slot>
</span>
</div>
|
b26389a0
xiaofengsha
* 对照AntDesign,实现了...
|
7
8
9
|
</template>
<script>
|
e9ad2b7a
梁灏
update Divider
|
10
|
import {oneOf} from '../../utils/assist';
|
b26389a0
xiaofengsha
* 对照AntDesign,实现了...
|
11
|
|
e9ad2b7a
梁灏
update Divider
|
12
|
const prefixCls = 'ivu-divider';
|
b26389a0
xiaofengsha
* 对照AntDesign,实现了...
|
13
|
|
e9ad2b7a
梁灏
update Divider
|
14
15
16
17
18
19
20
21
22
23
24
25
|
export default {
name: 'Divider',
props: {
type: {
type: String,
default: 'horizontal',
validator (value) {
return oneOf(value, ['horizontal', 'vertical']);
}
},
orientation: {
type: String,
|
a0141266
梁灏
update Divider style
|
26
|
default: 'center',
|
e9ad2b7a
梁灏
update Divider
|
27
|
validator (value) {
|
a0141266
梁灏
update Divider style
|
28
|
return oneOf(value, ['left', 'right', 'center']);
|
e9ad2b7a
梁灏
update Divider
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
}
},
dashed: {
type: Boolean,
default: false,
}
},
computed: {
hasSlot() {
return !!this.$slots.default;
},
classes() {
return [
`${prefixCls}`,
`${prefixCls}-${this.type}`,
{
|
9cdfb2e2
梁灏
fix #5135
|
45
|
[`${prefixCls}-with-text`]: this.hasSlot && this.orientation === 'center',
|
e9ad2b7a
梁灏
update Divider
|
46
47
48
49
50
51
52
53
|
[`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot,
[`${prefixCls}-dashed`]: !!this.dashed
}
];
},
slotClasses() {
return [
`${prefixCls}-inner-text`,
|
77376451
梁灏
fixed #3568
|
54
|
];
|
e9ad2b7a
梁灏
update Divider
|
55
|
}
|
b26389a0
xiaofengsha
* 对照AntDesign,实现了...
|
56
|
}
|
77376451
梁灏
fixed #3568
|
57
|
};
|
e9ad2b7a
梁灏
update Divider
|
58
|
</script>
|